Jump to content
Sign in to follow this  
ThisJazzman

Fix crash on weapon changing

Recommended Posts

ThisJazzman

PlayerInventory._add_unit_by_factory_name = PlayerInventory._add_unit_by_factory_name or PlayerInventory.add_unit_by_factory_name

function PlayerInventory:add_unit_by_factory_name(factory_name, equip, instant, blueprint, texture_switches, ...)

  local factory_weapon = tweak_data.weapon.factory[factory_name]

  local ids_unit_name = Idstring(factory_weapon.unit)

  managers.dyn_resource:load(Idstring("unit"), ids_unit_name, "packages/dyn_resources", false)

  return self:_add_unit_by_factory_name(factory_name, equip, instant, blueprint, texture_switches, ...)

end

My first ever contribution and 1 tip, don't use your weapon while it is loading or else game will crash.

Share this post


Link to post
Share on other sites
PirateCaptain

PlayerInventory._add_unit_by_factory_name = PlayerInventory._add_unit_by_factory_name or PlayerInventory.add_unit_by_factory_name

function PlayerInventory:add_unit_by_factory_name(factory_name, equip, instant, blueprint, texture_switches, ...)

  local factory_weapon = tweak_data.weapon.factory[factory_name]

  local ids_unit_name = Idstring(factory_weapon.unit)

  managers.dyn_resource:load(Idstring("unit"), ids_unit_name, "packages/dyn_resources", false)

  return self:_add_unit_by_factory_name(factory_name, equip, instant, blueprint, texture_switches, ...)

end

My first ever contribution and 1 tip, don't use your weapon while it is loading or else game will crash.

well hello and welcome... thanks saved me a lot of work :thumbsup: :thumbsup:

Share this post


Link to post
Share on other sites
angelicoreXX

is there a fix for it cause sometime i wanna change my weapon without crashing others due to wrong weapon choice

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now
Sign in to follow this  

×