Schall Recharging Weapon


Experimental recharge mechanism. Introduced energy weapons, which recharge from personal batteries! Currently includes laser rifle, laser sniper rifle, laser shotgun, laser machine gun, mega laser cannon, chainsaw. (Locale: English, Deutsch, 正體中文, 简体中文, Português Brasileiro, Русский)

Content
3 years ago
0.17 - 1.1
6.40K
Combat

b [Solved] Crash (from 0.17.35 changes)

4 years ago

Hello, received the following fatal error while clicking on a conveyor belt to build:

Error while running event SchallRechargingWeapon::on_player_cursor_stack_changed (ID 29)
real number expected got nil.
stack traceback:
SchallRechargingWeapon/control.lua:98: in function 'main_inventory_clear_ammo'
SchallRechargingWeapon/control.lua:127: in function <SchallRechargingWeapon/control.lua:126>
stack traceback:
[C]: in function 'get_inventory'
SchallRechargingWeapon/control.lua:98: in function 'main_inventory_clear_ammo'
SchallRechargingWeapon/control.lua:127: in function <SchallRechargingWeapon/control.lua:126>

4 years ago

It is due to the big internal changes from version 0.17.35 update.
I will try updating all my mods on these days, or you can downgrade game to 0.17.34 if you don't want to wait.

4 years ago

Patch to support 0.17.35:

diff -urN SchallRechargingWeapon_0.17.4/changelog.txt SchallRechargingWeapon_0.17.5/changelog.txt
--- SchallRechargingWeapon_0.17.4/changelog.txt 2019-04-19 09:06:43.782645200 +1000
+++ SchallRechargingWeapon_0.17.5/changelog.txt 2019-05-04 11:02:38.573453900 +1000
@@ -1,4 +1,9 @@
 ---------------------------------------------------------------------------------------------------
+Version: 0.17.5
+Date: 2019.05.04
+  Bugfixes:
+    - Support for 0.17.35
+---------------------------------------------------------------------------------------------------
 Version: 0.17.4
 Date: 2019.04.19
   Features:
diff -urN SchallRechargingWeapon_0.17.4/control.lua SchallRechargingWeapon_0.17.5/control.lua
--- SchallRechargingWeapon_0.17.4/control.lua   2019-03-22 21:59:44.902814200 +1100
+++ SchallRechargingWeapon_0.17.5/control.lua   2019-05-04 10:22:14.915656900 +1000
@@ -24,9 +24,9 @@

 local function recharge_weapons(e)
   local player = game.players[e.player_index]
-  local gun = player.get_inventory(defines.inventory.player_guns)
+  local gun = player.get_inventory(defines.inventory.character_guns)
   if not gun then return end
-  local ammo = player.get_inventory(defines.inventory.player_ammo)
+  local ammo = player.get_inventory(defines.inventory.character_ammo)
   local recharge_guns = {}
   local non_recharge_guns = {}
   local ammoname
@@ -95,7 +95,7 @@

 local function main_inventory_clear_ammo(e)
   local player = game.players[e.player_index]
-  local maininv = player.get_inventory(defines.inventory.player_main)
+  local maininv = player.get_main_inventory()
   if not maininv then return end
   local num
   for ammo,v in pairs(recharge_charges) do
diff -urN SchallRechargingWeapon_0.17.4/info.json SchallRechargingWeapon_0.17.5/info.json
--- SchallRechargingWeapon_0.17.4/info.json 2019-04-19 08:34:54.514407200 +1000
+++ SchallRechargingWeapon_0.17.5/info.json 2019-05-04 11:02:00.676219800 +1000
@@ -1,6 +1,6 @@
 {
   "name": "SchallRechargingWeapon",
-  "version": "0.17.4",
+  "version": "0.17.5",
   "title": "Schall Recharging Weapon",
   "author": "Schallfalke",
   "email": "",
@@ -8,5 +8,5 @@
   "contact": "",
   "description": "Experimental recharge mechanism.  Introduced energy weapons, which recharge from personal batteries!\nCurrently includes laser rifle, laser sniper rifle, laser shotgun, laser machine gun, mega laser cannon, chainsaw.",
   "factorio_version": "0.17",
-  "dependencies": ["base >= 0.17.0", "? SchallPrimaryBattery"]
-}
\ No newline at end of file
+  "dependencies": ["base >= 0.17.35", "? SchallPrimaryBattery"]
+}
4 years ago

Thanks for the prompt responses! (and a patch, too!)

4 years ago

Should be fixed in recent version 0.17.5.
And thanks mrudat for making the patch. (I didn't have the time to sit in front of my home computer last days.)

New response