Jump to content

Data Structure Navigation Question (TurretLoot)


nivina

Recommended Posts

I'm new to LUA and hitting many roadblocks, the most silly of which is... How on earth do I make my way from TurretLoot, which is created when loot comes off a corpse, to the actual Weapon that I can modify the properties of?

 

For the sake of argument, say I want to set the range of all mining lasers to 1 (cuz i hate miners and everything they stand for).

 

Please resist the urge to direct me to turretgenerator.lua, that's not what I'm asking. I specifically want to understand how I can navigate from TurretLoot to a Weapon. This knowledge will help me in a bunch of other areas, I'm sure.

 

function onEntityCreate(entityIndex)
    local entity = Entity(entityIndex)

    if entity:hasComponent(ComponentType.TurretLoot) then
        -- local weapon = howdo?

        if weapon.?? == WeaponType.MiningLaser then
            weapon.reach = 1 -- screw you miner
            weapon.blength = weapon.reach -- and the horse you road in on
        end
    end
end

Link to comment
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

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...