Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

self.Magazine is nil in Create()

Offen
#88 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
cpp, lua
Bereich
game-dev

Rechercherichtung

Start with Data/Browncoats.rte/Devices/Weapons/Extinction/Extinction.lua and the reported Create() call that accesses self.Magazine; compare its fallback with the failing mod's INI magazine setup. Use the supplied mods and benchmark activity to reproduce the intermittent nil value at startup, then trace where the magazine is initialized. Done means the cause is identified and self.Magazine is reliably available when Create() uses it.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Describe the bug
self.Magazine can seemingly randomly be nil in Create()

Pawnis' recent Browncoat script even points it out with a comment, in Data/Browncoats.rte/Devices/Weapons/Extinction/Extinction.lua:

self.maxAmmoCount = self.Magazine and self.Magazine.Capacity or 5; -- loading a game might mess this up, so... fall-back

In the mod I found the issue, the error originates from here:

function Create(self)
	self.ammoCounter = 100
	self.recoil = 0

	self.ff = false

	print(self.Magazine)
	self.f0 = ToMagazine(self.Magazine).RoundCount

	self.f1 = ToMagazine(self.Magazine).RoundCount
	self.firetimer = Timer()
end

I added the print(self.Magazine), and it shows that self.Magazine is nil a portion of the time it gets printed here.

Where the single ini file where it's used looks roughly like this:

AddAmmo = Magazine
	PresetName = Magazine ChainChoppa

AddDevice = HDFirearm
	PresetName = Chain Choppa
	ScriptPath = orks.rte/Weapons/ChainChoppa/ChainChoppa.lua
	Magazine = Magazine
		CopyOf = Magazine ChainChoppa

To Reproduce
I haven't taken the time to make a Minimal Reproducible Example yet, but this should show the error after a minute or two of running:

  1. Download orks.rte.zip
  2. Download Benchmark.rte.zip
  3. Use this in your Settings.ini to instantly have the issue printed when the game boots:
	LaunchIntoActivity = 1
	DefaultActivityType = GAScripted
	DefaultActivityName = Combat Benchmark
	DefaultSceneName = Benchmark
Vorherrschende Sprache
C++
Sterne
329
Forks
47
Ø Merge
6 T. 10 Std.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cortex-command-community/Cortex-Command-Community-Project

Alle Issues in cortex-command-community/Cortex-Command-Community-Project

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.