Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

self.Magazine is nil in Create()

Ouverte
#88 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
cpp, lua
Domaine
game-dev

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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
Langage dominant
C++
Étoiles
329
Forks
47
Merge moyen
6 j 10 h
PR mergées (30 j)
14

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de cortex-command-community/Cortex-Command-Community-Project

Toutes les issues de cortex-command-community/Cortex-Command-Community-Project

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.