|
|
Line 1: |
Line 1: |
| '''Source Engine 2009''' | | '''Aperture Science''' is the mysterious research corporation behind the plot of [[Portal]]. |
|
| |
|
| "Garry's Mod" (Tools > Options > Edit > Add)
| | According to [http://www.aperturescience.com its website], Aperture was founded by [[Cave Johnson]] in 1953 as a manufacturer of shower curtains. 26 years later, Aperture began development of the 'man-sized ad hoc quantum tunnel through physical space with possible applications as a shower curtain,' also called the 'Portal.' |
|
| |
|
| Game Data Files:
| | Aperture eventually created the [[weapon_portalgun|Aperture Science Handheld Portal Device]], and built the [[Aperture Science Enrichment Center]] to test it. They also created [[GLaDOS]] in response to the news that [[Black Mesa]] was working on a similar portal technology. |
| (orangebox/bin)
| |
| HalfLife2.fgd = Ep2 (HL2 as well)
| |
| base.fgd
| |
| cstrike.fgd = CS:S
| |
| dod.fgd = DoD:S
| |
| hl2mp.fgd = HL2:DM (could be needed)
| |
| portal.fgd = Portal | |
| tf.fgd = TF2 (garrysmod/garrysmod)
| |
| Garrysmod.fgd (optional lang.)
| |
|
| |
|
| | The game, Portal, is set mostly in the test chambers of the Aperture Science Enrichment Center. After escaping the test chambers (and near-death), the player finds that the Enrichment Center is deserted, with abandoned desks and disconnected phones. It is apparently run only by GLaDOS. |
| | <nowiki>The Company's Slogan: Aperture Science: We do what we must, because we can. </nowiki> |
|
| |
|
| Default Point Entity class: info_player_start
| | [[Category:Half-Life Continuity]] |
| | |
| Default SolidEntity class: func_detail
| |
| | |
| Cordon Texture: tools/toolsskybox
| |
| | |
| Game Executable Directory: $SteamUserDir\garrysmod
| |
| | |
| Game Directory: $SteamUserDir\garrysmod\garrysmod
| |
| | |
| Hammer VMF Directory: (Where you want to save and load VMF saves for Garrysmod) i use.. $SteamUserDir\garrysmod\garrysmod\maps\vmf
| |
| | |
| Now go to the last Tab, Build programs..
| |
| | |
| Game Executable: $SteamUserDir\garrysmod\hl2.exe
| |
| | |
| BSP $SteamUserDir\sourcesdk\bin\orangebox\bin\vbsp.exe
| |
| | |
| VIS $SteamUserDir\sourcesdk\bin\orangebox\bin\vvis.exe
| |
| | |
| RAD $SteamUserDir\sourcesdk\bin\orangebox\bin\vrad.exe
| |
| | |
| Place compiled maps... $SteamUserDir\garrysmod\garrysmod\maps
| |
| | |
| It will say that the changes will show when you open hammer another time but you need to restart Source SDK if you made a new config in order to see your new config in the selection menu.
| |
| | |
| | |
| | |
| Tagalog, pwede ba? :(
| |
| | |
| ==Keyvalues==
| |
| {{KV|Damage pushes player|bool|Being hit by this turret will push the player back.}}
| |
| {{KV|Turret is Gagged|boolean|Turret will not speak any lines.|since=P2}}
| |
| {{KV|Used As Actor|boolean|Turret will not run the standard floor turret code so it can be used as an actor.|since=P2}}
| |
| {{KV|Turret can be picked up by player|boolean|Disables pickup by player.|since=P2}}
| |
| {{KV|Disable Motion|boolean|Set for turrets that can't move in the world.|since=P2}}
| |
| {{KV|Allow Shooting through portals|boolean|Turrets will not try to shoot through portals unless this is set.|since=P2}}
| |
| {{KV|Maximum Range|float|How far the turret will be able to see targets.|since=P2}}
| |
| {{KV|Load Defective Models|boolean|Should this turret precache the defective models? Needed for late switching.|since=P2}}
| |
| {{KV|Use Super Damage|boolean|Setting this to true will scale the turret's damage by a very large amount.|since=P2}}
| |
| {{KV|Collision Type|choices|Allow collision with the player to be turned off for very special cases.|since=P2}}
| |
| :* 0 : Normal
| |
| :* 1 : Debris
| |
| {{KV|Model|choices|Which model the turret uses. The skeleton turret is still functional.|since=P2}}
| |
| :* 0 : Normal
| |
| :* 1 : Unused
| |
| :* 2 : Box
| |
| :* 3 : Backwards
| |
| :* 4 : Skeleton
| |
| {{KV npc_turret_floor}}
| |
| | |
| == Freeman.lua ==
| |
| | |
| local Category = "Humans + Resistance"
| |
| | |
| | |
| local NPC = { Name = "Gordon Freeman",
| |
| Class = "npc_citizen",
| |
| Model = "models/katharsmodels/gordon_freeman/gordon_freeman.mdl",
| |
| Health = "100",
| |
| KeyValues = { citizentype = 4 },
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", "npc_freeman", NPC )
| |
| | |
| == Stargate.lua ==
| |
| | |
| -- Small library loader! Therefore no GPL Header (but it's GPLed)
| |
| StarGate = StarGate or {};
| |
| include("stargate/VERSION.lua");
| |
| -- Only loads serverside files on server,clientside files on client, shared on both and vgui on client
| |
| local function ValidToInclude(state)
| |
| return (state == "server" and SERVER) or ((state == "client" or state == "vgui") and CLIENT) or state == "shared";
| |
| end
| |
| --################# Loads the libraries @aVoN
| |
| function StarGate.Load()
| |
| MsgN("=======================================================");
| |
| MsgN("StarGate Pack: Initializing");
| |
| MsgN("Version: "..StarGate.VERSION.."\n");
| |
| for _,state in pairs({"shared","server","client","vgui"}) do
| |
| -- Init always comes at first!
| |
| if(ValidToInclude(state) and #file.FindInLua("stargate/"..state.."/init.lua") == 1) then
| |
| MsgN("Loading: stargate/"..state.."/init.lua");
| |
| include("stargate/"..state.."/init.lua");
| |
| end
| |
| for _,v in pairs(file.FindInLua("stargate/"..state.."/*.lua")) do
| |
| if(SERVER and state ~= "server") then
| |
| AddCSLuaFile("stargate/"..state.."/"..v); -- Add clientside files
| |
| end
| |
| if(ValidToInclude(state) and v ~= "init.lua") then
| |
| MsgN("Loading: stargate/"..state.."/"..v);
| |
| include("stargate/"..state.."/"..v);
| |
| end
| |
| end
| |
| end
| |
| if(SERVER) then
| |
| AddCSLuaFile("autorun/stargate.lua"); -- Ourself of course!
| |
| AddCSLuaFile("stargate/VERSION.lua"); -- Version
| |
| AddCSLuaFile("weapons/gmod_tool/stargate_base_tool.lua"); -- Special GMOD Basetool
| |
| end
| |
| MsgN("=======================================================");
| |
| end
| |
| StarGate.Load();
| |
| | |
| --################# For the concommand @aVoN
| |
| function StarGate.CallReload(p,override) -- Override is called in stargate_base/init.lua if someone calls lua_reloadents
| |
| if(override or (not ValidEntity(p) or SinglePlayer() or p:IsAdmin())) then
| |
| StarGate.Load();
| |
| for _,v in pairs(player.GetAll()) do
| |
| v:SendLua("StarGate.Load()");
| |
| end
| |
| else
| |
| p:SendLua("StarGate.Load()");
| |
| end
| |
| end
| |
| | |
| if SERVER then
| |
| concommand.Add("stargate_reload",StarGate.CallReload);
| |
| end
| |
| | |
| == Ringtransporter init.lua ==
| |
| | |
| | |
| AddCSLuaFile( "cl_init.lua" )
| |
| AddCSLuaFile( "shared.lua" )
| |
| include('shared.lua')
| |
| | |
| function ENT:Initialize()
| |
| self.Entity:SetModel("models/Zup/sg_rings/ring.mdl")
| |
| self.Entity:PhysicsInit( SOLID_VPHYSICS )
| |
| self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
| |
| self.Entity:SetSolid(SOLID_VPHYSICS)
| |
|
| |
| self.Phys=self.Entity:GetPhysicsObject()
| |
| self.Phys:EnableCollisions(false)
| |
| self.Phys:Wake()
| |
| self.Phys:EnableMotion(true)
| |
|
| |
| self.Parent=self.Entity:GetParent()
| |
| self.Entity:SetParent(nil)
| |
|
| |
| self.ReachedPos=true
| |
| self.DesiredPos=self.Entity:GetPos()
| |
| self.Return=true
| |
| self.Ang=self.Entity:GetAngles()
| |
| self.Entity:StartMotionController()
| |
| | |
| self.Entity:SetTrigger(true)
| |
| end
| |
| | |
| function ENT:PhysicsSimulate( phys, deltatime )
| |
| phys:Wake()
| |
| local pr={}
| |
| pr.secondstoarrive = 1
| |
| local pos=self.Parent:LocalToWorld(self.DesiredPos)
| |
| pr.pos = pos
| |
| if self.Return then
| |
| pr.pos = self.Parent:GetPos()
| |
| end
| |
| pr.maxangular = 5000
| |
| pr.maxangulardamp = 10000
| |
| pr.maxspeed = 10000
| |
| pr.maxspeeddamp = 100000
| |
| pr.dampfactor = 0.2
| |
| if not self.Return and self.ReachedPos then
| |
| pr.secondstoarrive = 0.01
| |
| pr.dampfactor = 1
| |
| end
| |
| pr.teleportdistance = 10000
| |
| pr.angle = self.Ang
| |
| pr.deltatime = deltatime
| |
| phys:ComputeShadowControl(pr)
| |
| end
| |
| | |
| function ENT:GotoPos(len)
| |
| if not self or not self.Entity or not self.Entity:IsValid() then return end
| |
| self.Return=false
| |
| self.ReachedPos=false
| |
| self.DesiredPos=len
| |
| end
| |
| | |
| function ENT:StartTouch(ent)
| |
| if self.ReachedPos then return end
| |
| if ent:GetClass()=="prop_physics" or ent:IsPlayer() then
| |
| ent:TakeDamage(1000, self.Entity)
| |
| end
| |
| end
| |
| | |
| function ENT:ReturnPos()
| |
| if not self or not self.Entity or not self.Entity:IsValid() then return end
| |
| self.Return=true
| |
| end
| |
| | |
| function ENT:Think()
| |
| if not self.ReachedPos then
| |
| local pos=self.Parent:LocalToWorld(self.DesiredPos)
| |
| if self.Entity:GetPos():Distance(pos)<10 then
| |
| self.ReachedPos=true
| |
| self.Parent:ReportReachedPos(self.Entity)
| |
| end
| |
| end
| |
| end
| |
| | |
| == Extra NPC.lua ==
| |
| | |
| ocal Category = "Humans + Resistance"
| |
| local NPC = { Name = "ResistanceTurret",
| |
| Class = "npc_turret_floor",
| |
| OnFloor = true,
| |
| TotalSpawnFlags = SF_FLOOR_TURRET_CITIZEN,
| |
| Skin = 1,
| |
| Offset = 8,
| |
| Icon = "materials\VGUI\entities\Rebelturret",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", "Rebelturret", NPC )
| |
| | |
| local NPC = { Name = "Fisherman",
| |
| Class = "npc_fisherman",
| |
| Category = Category }
| |
| | |
| local Category = "Animals"
| |
| | |
| local NPC = { Name = "Ichthyosaur",
| |
| Class = "npc_ichthyosaur",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| Category = "Combine"
| |
| | |
| local NPC = { Name = "Rollermine",
| |
| Class = "npc_rollermine",
| |
| Offset = 16,
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| local NPC = { Name = "Turret",
| |
| Class = "npc_turret_floor",
| |
| OnFloor = true,
| |
| TotalSpawnFlags = 0,
| |
| Offset = 2,
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| local NPC = { Name = "Combine Soldier",
| |
| Class = "npc_combine_s",
| |
| Model = "models/combine_soldier.mdl",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| | |
| local NPC = { Name = "Prison Guard",
| |
| Class = "npc_combine_s",
| |
| Model = "models/combine_soldier_prisonguard.mdl",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", "CombinePrison", NPC )
| |
| | |
| | |
| | |
| local NPC = { Name = "Combine Elite",
| |
| Class = "npc_combine_s",
| |
| Model = "models/combine_super_soldier.mdl",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", "CombineElite", NPC )
| |
| | |
| | |
| | |
| local NPC = { Name = "City Scanner",
| |
| Class = "npc_cscanner",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| | |
| local NPC = { Name = "Manhack",
| |
| Class = "npc_manhack",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Strider",
| |
| Class = "npc_strider",
| |
| Category = Category }
| |
| | |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Hopper",
| |
| Class = "combine_mine",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Camera",
| |
| Class = "npc_combine_camera",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Drop ship",
| |
| Class = "npc_combinedropship",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Gunship",
| |
| Class = "npc_combinegunship",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Stalker",
| |
| Class = "npc_stalker",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Claw scanner",
| |
| Class = "npc_clawscanner",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| | |
| local NPC = { Name = "Sniper",
| |
| Class = "npc_sniper",
| |
| Category = Category }
| |
| | |
| list.Set( "NPC", NPC.Class, NPC )
| |
| | |
| == Hoverbike.lua ==
| |
| | |
| local V = {
| |
| Name = "Hover Bike",
| |
| Class = "prop_vehicle_airboat",
| |
| Category = "Half-Life 2",
| |
| Author = "'''Alvin Luzon'''",
| |
| Information = "",
| |
| Model = "models/hoverbike.mdl",
| |
|
| |
| KeyValues = {
| |
| vehiclescript = "scripts/vehicles/hoverbike_script.txt"
| |
| }
| |
| }
| |
| | |
| list.Set( "Vehicles", "hoverbike", V )
| |
| | |
| == mad_physgun_limited.lua ==
| |
| | |
| if (SERVER) then
| |
| AddCSLuaFile("mad_physgun_limited.lua")
| |
| end
| |
| | |
| /*---------------------------------------------------------
| |
| Name: MadPhysgunPickup()
| |
| Desc: Return true if player can pickup entity (Alvin Luzon is playing dumb)
| |
| ---------------------------------------------------------*/
| |
| | |
| function MadPhysgunPickup(ply, ent)
| |
| | |
| // Never pick up a grenade
| |
| if (ent:GetClass() == "ent_mad_grenade") then return false end
| |
| | |
| // Never pick up a grenade launcher
| |
| if (ent:GetClass() == "ent_mad_grenadelauncher") then return false end
| |
| | |
| // Never pick up a mine
| |
| if (ent:GetClass() == "ent_mad_mine") then return false end
| |
| | |
| // Never pick up a rocket
| |
| if (ent:GetClass() == "ent_mad_rocket") then return false end
| |
| | |
| // Never pick up a C4
| |
| if (ent:GetClass() == "ent_mad_c4") then return false end
| |
| | |
| // Never pick up a flare
| |
| if (ent:GetClass() == "ent_mad_flare") then return false end
| |
| | |
| // Never pick up a flash grenade
| |
| if (ent:GetClass() == "ent_mad_flash") then return false end
| |
| | |
| // Never pick up a smoke grenade
| |
| if (ent:GetClass() == "ent_mad_smoke") then return false end
| |
| end
| |
| hook.Add("PhysgunPickup", "MadPhysgunPickup", MadPhysgunPickup)
| |
| | |
| == Laserlib.lua ==
| |
| | |
| /*
| |
| Playing dumb again lol. Ayoko na mag i-Cafe.
| |
| */
| |
| | |
| LaserLib = LaserLib or {};
| |
| | |
| | |
| //////////////////////////////
| |
| //// Shared Functions ////
| |
| //////////////////////////////
| |
| | |
| function LaserLib.GetReflectedVector( incidentVector, surfaceNormal )
| |
| | |
| return incidentVector - 2 * ( surfaceNormal:DotProduct( incidentVector ) * surfaceNormal );
| |
| | |
| end
| |
| | |
| function LaserLib.DoBeam ( laserEnt, beamDir, beamStart, beamLength, ... )
| |
| local trace = {};
| |
|
| |
| local beamStart = util.LocalToWorld(laserEnt, beamStart);
| |
|
| |
| laserEnt.IgnoreList = laserEnt.IgnoreList or {};
| |
| local beamFilter = table.Copy(laserEnt.IgnoreList);
| |
| table.insert(beamFilter, laserEnt);
| |
|
| |
| if ( SERVER ) then
| |
| inflictor = laserEnt.ply;
| |
| beamDamage = unpack(arg);
| |
| laserEnt.Targets = {}; -- we'll store here what we hit
| |
| end
| |
|
| |
| if ( CLIENT ) then
| |
| beamPoints = { beamStart };
| |
| beamIgnore = {};
| |
| beamWidth, beamMaterial = unpack(arg);
| |
| end
| |
| | |
| local bounces = 0;
| |
| | |
| repeat
| |
| if ( StarGate ~= nil ) then
| |
| trace = StarGate.Trace:New( beamStart, beamDir:Normalize() * beamLength, beamFilter );
| |
| else
| |
| trace = util.QuickTrace( beamStart, beamDir:Normalize() * beamLength, beamFilter );
| |
| end
| |
|
| |
| if ( CLIENT ) then table.insert( beamPoints, trace.HitPos ); end
| |
|
| |
| -- we can bounce!
| |
| if ( trace.Entity and trace.Entity:IsValid() and
| |
| ( ( (trace.Entity:GetClass() == "event_horizon" and ValidEntity(trace.Entity.Target)
| |
| and trace.Entity:GetForward():DotProduct(trace.Normal) < 0 and trace.Entity ~= trace.Entity.Target)
| |
| or trace.Entity:GetModel() == "models/madjawa/laser_reflector.mdl"
| |
| or trace.Entity:GetMaterial() == "debug/env_cubemap_model" )
| |
| and trace.Entity:GetClass() ~= "gmod_laser_crystal" ) ) then
| |
|
| |
| isMirror = true;
| |
|
| |
| beamFilter = table.Copy(laserEnt.IgnoreList);
| |
| table.insert(beamFilter, trace.Entity);
| |
| if (trace.Entity:GetClass() == "event_horizon") then
| |
| if (not (CLIENT and not trace.Entity.DrawRipple) // HAX
| |
| and not (SERVER and (not trace.Entity:IsOpen() or trace.Entity.ShuttingDown))) then -- STARGATE!
| |
| beamStart, beamDir = trace.Entity:GetTeleportedVector(trace.HitPos, beamDir);
| |
| if (CLIENT) then
| |
| local n = table.insert( beamPoints, beamStart );
| |
| beamIgnore[n] = true; -- prevents from rendering a beam between the two stargates
| |
| end
| |
| table.insert(beamFilter, trace.Entity.Target);
| |
| if (SERVER) then
| |
| trace.Entity:EnterEffect(trace.HitPos, laserEnt:GetBeamWidth());
| |
| trace.Entity.Target:EnterEffect(beamStart, laserEnt:GetBeamWidth());
| |
| end
| |
| else isMirror = false;
| |
| end
| |
| else
| |
| beamStart = trace.HitPos;
| |
| beamDir = LaserLib.GetReflectedVector( beamDir, trace.HitNormal );
| |
| end
| |
| beamLength = beamLength - beamLength * trace.Fraction;
| |
|
| |
| elseif (SERVER and ValidEntity(trace.Entity) and trace.Entity:GetClass() == "event_horizon") then
| |
| trace.Entity:EnterEffect(trace.HitPos, laserEnt:GetBeamWidth());
| |
| else
| |
| isMirror = false;
| |
| end
| |
|
| |
| bounces = bounces + 1;
| |
|
| |
| if ( SERVER ) then
| |
| if ( ValidEntity(trace.Entity) and
| |
| ( trace.Entity:GetClass() == "gmod_laser_reflector" or trace.Entity:GetClass() == "gmod_laser_crystal" )
| |
| and not table.HasValue( trace.Entity.Hits, laserEnt ) ) then
| |
| trace.Entity:UpdateBounceCount(laserEnt);
| |
| end
| |
| end
| |
|
| |
| if (SERVER and ValidEntity(trace.Entity)) then table.insert(laserEnt.Targets, trace.Entity); end
| |
|
| |
| until ( isMirror == false or bounces > GetConVar("laser_maxbounces"):GetInt() )
| |
| | |
| if( SERVER and beamDamage > 0 and trace.Entity and trace.Entity:IsValid() and trace.Entity:GetClass() ~= "gmod_laser_crystal" and
| |
| trace.Entity:GetClass() ~= "gmod_laser" and trace.Entity:GetModel() ~= "models/madjawa/laser_reflector.mdl" ) then
| |
|
| |
| LaserLib.DoDamage( trace.Entity, trace.HitPos, trace.Normal, beamDir, beamDamage, inflictor,
| |
| laserEnt:GetDissolveType(), laserEnt:GetPushProps(), laserEnt:GetKillSound(), laserEnt );
| |
|
| |
| end
| |
|
| |
| if ( CLIENT ) then
| |
| --Fucking FIXME: weird bugs/shadows/laser disappearing seem to caused by renderbounds
| |
| local prevPoint = beamPoints[1];
| |
| local bbmin, bbmax = laserEnt:GetRenderBounds();
| |
|
| |
| if not matTab or not matTab[beamMaterial] then
| |
| matTab[beamMaterial] = Material(beamMaterial);
| |
| end
| |
| render.SetMaterial( matTab[beamMaterial] );
| |
|
| |
| for k, v in pairs ( beamPoints ) do
| |
| if ( prevPoint ~= v and not beamIgnore[k]==true) then
| |
| render.DrawBeam( prevPoint, v, beamWidth, 13*CurTime(), 13*CurTime() - ( v - prevPoint ):Length()/9, Color( 255, 255, 255, 255 ) );
| |
| end
| |
| prevPoint = v;
| |
|
| |
| local pos = laserEnt:WorldToLocal(v);
| |
| if ( pos.x < bbmin.x ) then bbmin.x = pos.x; end
| |
| if ( pos.y < bbmin.y ) then bbmin.y = pos.y; end
| |
| if ( pos.z < bbmin.z ) then bbmin.z = pos.z; end
| |
| if ( pos.x > bbmax.x ) then bbmax.x = pos.x; end
| |
| if ( pos.y > bbmax.y ) then bbmax.y = pos.y; end
| |
| if ( pos.z > bbmax.z ) then bbmax.z = pos.z; end
| |
| end
| |
|
| |
| laserEnt.NextEffect = laserEnt.NextEffect or CurTime();
| |
| if ( not trace.HitSky and laserEnt:GetEndingEffect() and CurTime() >= laserEnt.NextEffect ) then
| |
| if ( trace.Entity and trace.Entity:IsValid() and trace.Entity:GetClass() == "gmod_laser_crystal" ) then return; end
| |
|
| |
| if not (trace.Entity:IsValid() and trace.Entity:GetClass() == "event_horizon") then
| |
| local effectdata = EffectData();
| |
| effectdata:SetStart( trace.HitPos );
| |
| effectdata:SetOrigin( trace.HitPos );
| |
| effectdata:SetNormal( trace.HitNormal );
| |
| effectdata:SetScale( 1 );
| |
| util.Effect( "AR2Impact", effectdata );
| |
| end
| |
| laserEnt.NextEffect = CurTime() + 0.1;
| |
| end
| |
|
| |
| laserEnt:SetRenderBounds( bbmin, bbmax, Vector()*6 );
| |
| end
| |
|
| |
| return trace.Entity;
| |
| end
| |
| | |
| | |
| //////////////////////////////
| |
| //// Server Functions ////
| |
| //////////////////////////////
| |
| | |
| if ( SERVER ) then
| |
| | |
| AddCSLuaFile( "autorun/laserlib.lua" );
| |
| | |
| function LaserLib.SpawnDissolver( ent, position, attacker, dissolveType )
| |
| Dissolver = ents.Create( "env_entity_dissolver" );
| |
| Dissolver.Target = "laserdissolve"..ent:EntIndex();
| |
| Dissolver:SetKeyValue( "dissolvetype", dissolveType );
| |
| Dissolver:SetKeyValue( "magnitude", 0 );
| |
| Dissolver:SetPos( position );
| |
| Dissolver:SetPhysicsAttacker( attacker );
| |
| Dissolver:Spawn();
| |
|
| |
| return Dissolver;
| |
| end
| |
|
| |
| function LaserLib.DoDamage( target, hitPos, normal, beamDir, damage, attacker, dissolveType, pushProps, killSound, laserEnt )
| |
|
| |
| laserEnt.NextLaserDamage = laserEnt.NextLaserDamage or CurTime();
| |
|
| |
| if ( pushProps and target:GetPhysicsObject():IsValid() ) then
| |
| local phys = target:GetPhysicsObject();
| |
| local mass = phys:GetMass();
| |
| local mul = math.Clamp( mass * 10, 0, 2000 );
| |
| if ( mul ~= 0 and mass <= 500 ) then
| |
| phys:ApplyForceOffset( beamDir * mul, hitPos );
| |
| end
| |
| end
| |
|
| |
| if ( target:GetClass() == "weapon_striderbuster" ) then return end;
| |
|
| |
| if ( CurTime() >= laserEnt.NextLaserDamage ) then
| |
| if ( target:IsVehicle() and target:GetDriver():IsValid() ) then -- we must kill the driver!
| |
| target = target:GetDriver();
| |
| target:Kill(); -- takedamage doesn't seem to work on a player inside a vehicle
| |
| end
| |
|
| |
| if ( target:GetClass() == "shield" ) then
| |
| target:Hit( laserEnt, hitPos, math.Clamp( damage / 2500 * 3, 0, 4), -1*normal );
| |
| laserEnt.NextLaserDamage = CurTime() + 0.3;
| |
| return; -- we stop here because we hit a shield
| |
| end
| |
|
| |
| if ( target:Health() <= damage ) then
| |
| if ( target:IsNPC() or target:IsPlayer() ) then
| |
| local dissolverEnt = LaserLib.SpawnDissolver( laserEnt, target:GetPos(), attacker, dissolveType );
| |
|
| |
| -- dissolving the NPC's weapon too
| |
| if ( target:IsNPC() and target:GetActiveWeapon():IsValid() ) then target:GetActiveWeapon():SetName( dissolverEnt.Target ); end
| |
|
| |
| target:TakeDamage( damage, attacker, laserEnt ); -- we kill the player/NPC to get his ragdoll
| |
|
| |
| if ( target:IsPlayer() ) then
| |
| if ( not target:GetRagdollEntity() or not target:GetRagdollEntity():IsValid() ) then return; end
| |
| target:GetRagdollEntity():SetName( dissolverEnt.Target ); -- thanks to Nevec for the player ragdoll idea, allowing us to dissolve him the cleanest way
| |
| else
| |
| if ( target.DeathRagdoll and target.DeathRagdoll:IsValid() ) then -- if Keep Corpses is disabled, DeathRagdoll is nil, so we need to check this
| |
| target.DeathRagdoll:SetName( dissolverEnt.Target );
| |
| else
| |
| target:SetName( dissolverEnt.Target );
| |
| end
| |
| end
| |
|
| |
| dissolverEnt:Fire( "Dissolve", dissolverEnt.Target, 0 );
| |
| dissolverEnt:Fire( "Kill", "", 0.1 );
| |
| dissolverEnt:Remove(); -- Makes sure it's removed. It MIGHT prevent the "no free edicts" error (I don't see what other entity could cause it right now)
| |
| end
| |
|
| |
| if ( killSound ~= nil and ( target:Health() ~= 0 or target:IsPlayer() ) ) then
| |
| WorldSound( Sound( killSound ), target:GetPos() );
| |
| target:EmitSound( Sound( killSound ) );
| |
| end
| |
| else
| |
| laserEnt.NextLaserDamage = CurTime() + 0.3;
| |
| end
| |
|
| |
| target:TakeDamage( damage, attacker, laserEnt );
| |
| end
| |
| end
| |
|
| |
| function LaserLib.AssignNPCRagdoll( entity, ragdoll )
| |
| -- it seems that's the only clean way to get the NPC's ragdoll in the DoDamage function -- Thanks to Kogitsune
| |
| entity.DeathRagdoll = ragdoll;
| |
| end
| |
| | |
| hook.Add( "CreateEntityRagdoll", "LaserLib.AssignNPCRagdoll", LaserLib.AssignNPCRagdoll );
| |
| | |
| end
| |
| | |
| | |
| //////////////////////////////
| |
| //// Client Functions ////
| |
| //////////////////////////////
| |
| | |
| if ( CLIENT ) then
| |
| matTab = matTab or {};
| |
|
| |
| function LaserLib.UpdateIgnoreList(um)
| |
| local laserEnt = ents.GetByIndex(um:ReadLong());
| |
| local nbEnt = um:ReadLong();
| |
|
| |
| laserEnt.IgnoreList = {};
| |
| for i=1, nbEnt do
| |
| table.insert(laserEnt.IgnoreList, ents.GetByIndex(um:ReadLong()));
| |
| end
| |
| end
| |
| usermessage.Hook("Laser.UpdateIgnoreList", LaserLib.UpdateIgnoreList)
| |
| end
| |
| | |
| == Friends ==
| |
| | |
| ALLIES
| |
| | |
| • Caroline Gomez
| |
| • Jerico Cruz
| |
| • Miggy Nazareno
| |
| • Renato Miguel De Castro
| |
| • Owey Ramirez
| |
| • Chadster Guererro
| |
| • Roberto Patino
| |
| • Kevin Teogangco
| |
| | |
| | |
| AXIS
| |
| | |
| • Jonard Bonggat
| |
| • Dale Del Rosario
| |
| • Mark Sacriz
| |
| • Harry Tolentino
| |
| • Chris FlyingBy
| |
| • Breynette Amigo
| |
| | |
| == NPC Rocket Turret ==
| |
| | |
| ==Keyvalues==
| |
| {{KV|Rocket Speed|float|Speed the rocket will travel at.|since=P2}}
| |
| {{KV|Rocket Lifetime|float|The rocket will automatically detonate after this number of seconds.|since=P2}}
| |
| {{KV Parentname}}
| |
| {{KV Targetname}}
| |
| {{KV Angles}}
| |