Skip to content

Commit

Permalink
also load png on server, so correct image dimensions are known (else …
Browse files Browse the repository at this point in the history
…listen servers fail to copy memory to a too small buffer sometimes) + add enumerations + fix ents.FindByClass compat
  • Loading branch information
luttje committed Aug 18, 2024
1 parent 9d9b957 commit 1cda9df
Show file tree
Hide file tree
Showing 30 changed files with 1,722 additions and 1,644 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ game/experiment/lua_cache/*
game/experiment/materials/spawnicons/*
game/experiment/screenshots/*
game/experiment/data/*
game/experiment/downloadlists/*

# Build products that building the solution will create
game/experiment/bin/*
Expand Down
25 changes: 0 additions & 25 deletions docs/classes/Entity/GetPredictionPlayer.md

This file was deleted.

25 changes: 0 additions & 25 deletions docs/classes/Entity/GetPredictionRandomSeed.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/libraries/ConsoleVariables/Create.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ lua:
- name: "helpText"
type: string
default: "\"\""
- name: "hasMinimum"
type: boolean
default: "false"
- name: "minimum"
type: number
default: "0.0"
- name: "hasMaximum"
type: boolean
default: "false"
- name: "maximum"
type: number
default: "0"
Expand Down
26 changes: 26 additions & 0 deletions docs/libraries/Entities/GetByClass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
template: lua-library-function.html
title: GetByClass
icon: lua-shared
tags:
- lua
- shared
- needs-verification
- needs-example
lua:
library: Entities
function: GetByClass
realm: shared
description: "Gets all entities in the list by their class name"

arguments:
- name: "className"
type: string
returns:
- type: table
description: "A table of all entities in the entity list with the given class name."
---

<div class="lua__search__keywords">
Entities.GetByClass &#x2013; Gets all entities in the list by their class name
</div>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
template: lua-library-function.html
title: CreateMaterial
title: Create
icon: lua-client
tags:
- lua
- client
- needs-verification
- needs-example
lua:
library: Surfaces
function: CreateMaterial
library: Materials
function: Create
realm: client
description: "Creates a material"

Expand All @@ -27,5 +27,5 @@ lua:
---

<div class="lua__search__keywords">
Surfaces.CreateMaterial &#x2013; Creates a material
Materials.Create &#x2013; Creates a material
</div>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
template: lua-library-function.html
title: DoesMaterialExist
icon: lua-client
title: Exists
icon: lua-shared
tags:
- lua
- client
- shared
- needs-verification
- needs-example
lua:
library: Surfaces
function: DoesMaterialExist
realm: client
library: Materials
function: Exists
realm: shared
description: "Checks if a material exists"

arguments:
Expand All @@ -22,5 +22,5 @@ lua:
---

<div class="lua__search__keywords">
Surfaces.DoesMaterialExist &#x2013; Checks if a material exists
Materials.Exists &#x2013; Checks if a material exists
</div>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
template: lua-library-function.html
title: FindMaterial
icon: lua-client
title: Find
icon: lua-shared
tags:
- lua
- client
- shared
- needs-verification
- needs-example
lua:
library: Surfaces
function: FindMaterial
realm: client
library: Materials
function: Find
realm: shared
description: "Finds a material"

arguments:
Expand All @@ -25,5 +25,5 @@ lua:
---

<div class="lua__search__keywords">
Surfaces.FindMaterial &#x2013; Finds a material
Materials.Find &#x2013; Finds a material
</div>
4 changes: 2 additions & 2 deletions docs/libraries/Resources/AddFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lua:
library: Resources
function: AddFile
realm: server
description: "Add a file to the list of resources so it's downloaded when players connect to the server."
description: "Add a file to the list of resources so it's downloaded when players connect to the server. For convenience .vmt and .mdl will also add the related .vtf/.png/.jpg and model files (.vvd, .ani, .dx80.vtx, .dx90.vtx, .sw.vtx, .phy) with the same name. It will warn for each missing file."

arguments:
- name: "filePath"
Expand All @@ -21,5 +21,5 @@ lua:
---

<div class="lua__search__keywords">
Resources.AddFile &#x2013; Add a file to the list of resources so it's downloaded when players connect to the server.
Resources.AddFile &#x2013; Add a file to the list of resources so it's downloaded when players connect to the server. For convenience .vmt and .mdl will also add the related .vtf/.png/.jpg and model files (.vvd, .ani, .dx80.vtx, .dx90.vtx, .sw.vtx, .phy) with the same name. It will warn for each missing file.
</div>
25 changes: 25 additions & 0 deletions docs/libraries/Resources/AddSingleFile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
template: lua-library-function.html
title: AddSingleFile
icon: lua-server
tags:
- lua
- server
- needs-verification
- needs-example
lua:
library: Resources
function: AddSingleFile
realm: server
description: "Add a file to the list of resources so it's downloaded when players connect to the server."

arguments:
- name: "filePath"
type: string
returns:

---

<div class="lua__search__keywords">
Resources.AddSingleFile &#x2013; Add a file to the list of resources so it's downloaded when players connect to the server.
</div>
30 changes: 30 additions & 0 deletions docs/libraries/Vectors/Lerp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
template: lua-library-function.html
title: Lerp
icon: lua-shared
tags:
- lua
- shared
- needs-verification
- needs-example
lua:
library: Vectors
function: Lerp
realm: shared
description: "Linearly interpolates between two vectors."

arguments:
- name: "fraction"
type: number
- name: "from"
type: Vector
- name: "to"
type: Vector
returns:
- type: Vector
description: "The interpolated vector."
---

<div class="lua__search__keywords">
Vectors.Lerp &#x2013; Linearly interpolates between two vectors.
</div>
3 changes: 2 additions & 1 deletion game/experiment/addons/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
garrysmod/
/tacrp-melee/
/tacrp/
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ for enumKey, modifier in pairs(enumsToCopyToGlobal) do
end
end

local function stripUnderscores(enum)
return enum:gsub("_", "")
end

local enumsToMergeWithKey = {
-- OUR_ENUMERATION = "GMOD_ENUM",

CONTENTS = "CONTENTS",
COLLISION_GROUP = "COLLISION_GROUP",
-- ENTITY_EFFECT = "EF", -- See below
FCVAR = "FCVAR",
EDICT_FLAG = "FL_EDICT",
Expand All @@ -87,16 +94,31 @@ local enumsToMergeWithKey = {
MOVE_TYPE = "MOVETYPE",
OBSERVER_MODE = "OBS_MODE",
SOLID = "SOLID",
SURFACE = "SURF",
SURFACE = "SURF",

DAMAGE_TYPE = {"DMG", stripUnderscores},
HIT_GROUP = {"HITGROUP", stripUnderscores},
MATERIAL_TYPE = {"MAT", stripUnderscores},
}

for enumKey, enumTargetKey in pairs(enumsToMergeWithKey) do
if (not _E[enumKey]) then
error("Missing enumeration table for key: " .. enumKey)
continue
end
if (not _E[enumKey]) then
error("Missing enumeration table for key: " .. enumKey)
continue
end

local modifier

if (istable(enumTargetKey)) then
modifier = enumTargetKey[2]
enumTargetKey = enumTargetKey[1]
end

for enumKey, enumValue in pairs(_E[enumKey]) do
if (modifier) then
enumKey = modifier(enumKey)
end

for enumKey, enumValue in pairs(_E[enumKey]) do
_G[enumTargetKey .. "_" .. enumKey] = enumValue
end
end
Expand Down Expand Up @@ -406,71 +428,3 @@ FL_DISSOLVING = 536870912
FL_TRANSRAGDOLL = 1073741824
--- This moving door can't be blocked by the player
FL_UNBLOCKABLE_BY_PLAYER = -2147483648

---@enum DMG
--- Generic damage (used by weapon_fists)
DMG_GENERIC = 0
--- Caused by physics interaction and ignored by airboat drivers. This is used by the Rollermine and an unused animation attack called 'Fireattack' by the Antlion Guard [ACT_RANGE_ATTACK1](https://wiki.facepunch.com/gmod/Enums/ACT)
DMG_CRUSH = 1
--- Bullet damage from Ceiling Turrets, the Strider, Turrets and most guns.
DMG_BULLET = 2
--- Used by the Stunstick, Manhacks, Antlions, Antlion Guards, Headcrabs, Fast Headcrabs, all Zombies types, Hunter, and potentially other NPCs attacks
DMG_SLASH = 4
--- Damage from fire
DMG_BURN = 8
--- Hit by a vehicle (This will need to be set for passengers of some vehicle to receive damage)
DMG_VEHICLE = 16
--- Fall damage
DMG_FALL = 32
--- Explosion damage like grenades, helicopter bombs, combine mines, Will be ignored by most vehicle passengers.
DMG_BLAST = 64
--- Blunt attacks such as from the Crowbar, Antlion Guard & Hunter
DMG_CLUB = 128
--- Electrical damage, shows smoke at the damage position and its used by Stalkers & Vortigaunts
DMG_SHOCK = 256
--- Sonic damage, used by the Gargantua and Houndeye NPCs
DMG_SONIC = 512
--- Laser damage
DMG_ENERGYBEAM = 1024
--- Prevent a physics force.
DMG_PREVENT_PHYSICS_FORCE = 2048
--- Crossbow damage, never creates gibs.
DMG_NEVERGIB = 4096
--- Always create gibs
DMG_ALWAYSGIB = 8192
--- Drown damage
DMG_DROWN = 16384
--- Same as DMG_POISON
DMG_PARALYZE = 32768
--- Neurotoxin damage
DMG_NERVEGAS = 65536
--- Poison damage used by Antlion Workers & Poison Headcrabs.
DMG_POISON = 131072
--- Radiation damage & it will be ignored by most vehicle passengers
DMG_RADIATION = 262144
--- Damage applied to the player to restore health after drowning
DMG_DROWNRECOVER = 524288
--- Toxic chemical or acid burn damage used by the Antlion Workers
DMG_ACID = 1048576
--- In an oven
DMG_SLOWBURN = 2097152
--- Don't create a ragdoll on death
DMG_REMOVENORAGDOLL = 4194304
--- Damage done by the gravity gun.
DMG_PHYSGUN = 8388608
--- Plasma damage
DMG_PLASMA = 16777216
--- Airboat gun damage
DMG_AIRBOAT = 33554432
--- Forces the entity to dissolve on death. This is what the combine ball uses when it hits a target.
DMG_DISSOLVE = 67108864
--- This won't hurt the player underwater
DMG_BLAST_SURFACE = 134217728
--- Direct damage to the entity that does not go through any damage value modifications
DMG_DIRECT = 268435456
--- The pellets fired from a shotgun
DMG_BUCKSHOT = 536870912
--- Damage from SniperRound/SniperPenetratedRound ammo types
DMG_SNIPER = 1073741824
--- Damage from npc_missiledefense, npc_combinegunship, or monster_mortar
DMG_MISSILEDEFENSE = 2147483648
Loading

0 comments on commit 1cda9df

Please sign in to comment.