Skip to content

Commit fb553e1

Browse files
committed
Load primary/secondary ammo info from Lua + fix SWEP/ENT :Think not being called in Lua
1 parent 3ba140a commit fb553e1

File tree

7 files changed

+215
-131
lines changed

7 files changed

+215
-131
lines changed

docs/classes/Entity/Think.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template: lua-class-function.html
3-
title: Think
3+
title: ExecuteThink
44
icon: lua-shared
55
tags:
66
- lua
@@ -9,18 +9,18 @@ tags:
99
- needs-example
1010
lua:
1111
library: Entity
12-
function: Think
12+
function: ExecuteThink
1313
realm: shared
1414
description: "Think."
15-
15+
1616
arguments:
1717
- position: 1
1818
name: "entity"
1919
type: Entity
2020
returns:
21-
21+
2222
---
2323

2424
<div class="lua__search__keywords">
25-
Entity:Think &#x2013; Think.
25+
Entity:ExecuteThink &#x2013; Think.
2626
</div>

game/experiment/scripts/lua/includes/modules/scripted_entities.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function MODULE.Get(className)
1818

1919
foundEntity = table.Copy(foundEntity)
2020

21+
--- @cast foundEntity table
22+
foundEntity.Base = foundEntity.Base or _BASE_ENTITY_CLASS
23+
2124
if (foundEntity.Base ~= className) then
2225
local baseEntityTable = MODULE.GetStored(foundEntity.Base)
2326

game/experiment/scripts/lua/includes/modules/scripted_weapons.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ function MODULE.Get(weaponClassName)
1717
weaponTable = table.Copy(weaponTable)
1818

1919
--- @cast weaponTable table
20-
if (weaponTable.Base and weaponTable.Base ~= weaponClassName) then
20+
weaponTable.Base = weaponTable.Base or _BASE_WEAPON
21+
22+
if (weaponTable.Base ~= weaponClassName) then
2123
local baseWeaponTable = MODULE.GetStored(weaponTable.Base)
2224

2325
if (not baseWeaponTable) then

game/experiment/scripts/lua/weapons/weapon_experiment_base_scripted/shared.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ SWEP.AnimationPrefix = "python"
55
SWEP.InventorySlot = 1
66
SWEP.InventorySlotPosition = 1
77

8-
SWEP.MaxClip = 6
9-
SWEP.MaxClip2 = -1
10-
SWEP.DefaultClip = 6
11-
SWEP.DefaultClip2 = -1
12-
SWEP.PrimaryAmmo = "Pistol"
13-
SWEP.SecondaryAmmo = "None"
8+
SWEP.Primary.Ammo = "Pistol"
9+
SWEP.Primary.ClipSize = 6
10+
SWEP.Primary.DefaultClip = 6
11+
SWEP.Primary.Automatic = false
12+
13+
SWEP.Secondary.Ammo = "None"
14+
SWEP.Secondary.ClipSize = -1
15+
SWEP.Secondary.DefaultClip = -1
16+
SWEP.Secondary.Automatic = false
1417

1518
SWEP.Weight = 7
1619
SWEP.WeaponFlags = 0

0 commit comments

Comments
 (0)