Kagebunshin_mode

by fumoli

A mod that allows you to create clones that will run and scout the map.. Also, just for fun, you can add a trail of different parkicles behind the character model.

Tweaks
6 months ago
1.1
97
Environment Cheats

b Crash when clicking button while player has no character

9 months ago

I used the command

/c game.player.character = nil

on the console, then clicked your button and got this crash:

The mod Kagebunshin_mode (2.2.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Kagebunshin_mode::on_gui_click (ID 1)
__Kagebunshin_mode__/clones.lua:31: attempt to index field 'character' (a nil value)
stack traceback:
  __Kagebunshin_mode__/clones.lua:31: in function 'create_new_character_behind_player'
  __Kagebunshin_mode__/clones.lua:49: in function 'create_character'
  __Kagebunshin_mode__/button.lua:26: in function 'onHelloButtonClick'
  __Kagebunshin_mode__/button.lua:41: in function <__Kagebunshin_mode__/button.lua:39>

You can fix this by getting the surface from player instead of player.character in create_new_character_behind_player():

-- surface = player.character.surface
surface = player.surface

I removed my character deliberately to break your mod. :-D However, players having no character is a real issue as there are mods that put players in god mode (e.g. the satellite navigation view of Space Exploration), so you definitely should fix this!

9 months ago

I knew about this bug, but had no idea how to fix it. Thank you)

By the way. Fixed. Update in a couple of hours.

New response