Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

self.Magazine is nil in Create()

Aperta
#88 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp, lua
Ambito
game-dev

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C++
Stelle
329
Fork
47
Merge medio
6g 10h
PR unite (30g)
14

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cortex-command-community/Cortex-Command-Community-Project

Tutte le issue di cortex-command-community/Cortex-Command-Community-Project

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.