This code worked without issue in 0.95a rc15.
Spawning a projectile with the following line causes an immediate NPE in spec loading.
DamagingProjectileAPI shot = (DamagingProjectileAPI) engine.spawnProjectile(
ship,
null,
"prv_fracturer_system",
origin,
angle,
ship.getVelocity());
Attempted mitigations:
Removing the cast and assignment does not help.
Replacing "prv_fracturer_system" weapon id with "heavyblaster" or "lightac" does not help.
Replacing "prv_fracturer_system" weapon id with "bomb" bypasses the issue, the game does
not crash.
Replacing the null WeaponAPI argument with
ship.getAllWeapons().get(0) bypasses the issue, the game does
not crash.
Stack trace
1477399 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.loading.specs.F.getMoveSpeed(Unknown Source)
at com.fs.starfarer.combat.entities.MovingRay.<init>(Unknown Source)
at com.fs.starfarer.loading.specs.a.Ò00000(Unknown Source)
at com.fs.starfarer.loading.specs.a.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.spawnProjectile(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.spawnProjectile(Unknown Source)
at scripts.shipsystems.prv_fracturer.apply(prv_fracturer.java:106)
at com.fs.starfarer.combat.systems.return.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
.proj
{
"id":"prv_fracturer_shot",
"specClass":"projectile",
"onHitEffect":"scripts.weapons.prv_fracturer_OnHitEffect",
"spawnType":"BALLISTIC_AS_BEAM",
"collisionClass":"RAY_FIGHTER",
"collisionClassByFighter":"RAY_FIGHTER",
"length":45.0,
"width":7,
"fadeTime":0.3,
"fringeColor":[220,160,255,196],
"coreColor":[255,255,255,255],
"glowColor":[51,0,153,196],
"glowRadius":25,
"hitGlowRadius":25,
"textureScrollSpeed":64.0,
"pixelsPerTexel":5.0,
"bulletSprite":"graphics/missiles/shell_gauss_cannon.png"
}
.wpn
{
"id": "prv_fracturer_system",
"specClass":"projectile",
"type":"ENERGY",
"size":"MEDIUM",
"turretSprite":"graphics/weapons/blaster_turret_base.png",
"turretGlowSprite":"graphics/weapons/blaster_turret_glow.png",
"hardpointSprite":"graphics/weapons/blaster_hardpoint_base.png",
"hardpointGlowSprite":"graphics/weapons/blaster_hardpoint_glow.png",
#"glowColor":[155,100,255,255],
"glowColor":[51,0,153,196],
"turretOffsets":[10, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[15, 0],
"hardpointAngleOffsets":[0],
"barrelMode":"ALTERNATING", # or LINKED. whether barrels fire at the same time or alternate.
"animationType":"GLOW_AND_FLASH",
"muzzleFlashSpec":{"length":40.0, # only used if animationType = MUZZLE_FLASH
"spread":15.0,
"particleSizeMin":20.0,
"particleSizeRange":10.0,
"particleDuration":0.12,
"particleCount":12,
"particleColor":[51,0,153,196]},
#"autocharge":true, # whether the weapon will continue charging and fire if the LMB is tapped instead of held
#"requiresFullCharge":true, # for pulse weapons - whether the weapon will fire at a lower strength partial charge
"projectileSpecId":"prv_fracturer_shot", # projectile that will be fired
"fireSoundTwo":"heavy_blaster_fire",
}
weapon_data.csv
Fracture Packet,prv_fracturer_system,3,,0,2000,,150,,0,12,,,,,ENERGY,150,,,1,,,0,0,0,0,,700,,,,,,SYSTEM,,,prv Starworks,,Anti Flux,,,,,,,,,,87137