Jump to content

Recommended Posts

I'm in search of any info is there a way to increase minable/gatherable distance of a plant/deposit prefab. I can set collision physics alright but gather range is nowhere to be found. =(

Is there some comprehensive list of prefab parameters? Cuz all the guides focus on specifics and no complete list there to find. Makes modding some stuff hard and requires to search for similar and repurpose for myself. And that is really time consuming. T_T

The code involved happens here. When the locomotor is asked to go to something, it calculates an arrival distance. It is either specifically set in the buffered action (an attack, chop or whatever) OR calculated using a constant called ARRIVE_STEP and the physics-radius of both insts involved. This arrival distance is used in its OnUpdate() and when the locomotor is within the arrival distance, it fires the buffered action.

Have fun :) At least it's public.

function LocoMotor:GoToEntity(target, bufferedaction, run)
    self.dest = Dest(target)
    self.throttle = 1

    self:SetBufferedAction(bufferedaction)
    self.wantstomoveforward = true

    local arrive_dist = nil
    if bufferedaction ~= nil and bufferedaction.distance ~= nil then
        arrive_dist = bufferedaction.distance
    else
        arrive_dist = ARRIVE_STEP + target:GetPhysicsRadius(0) + self.inst:GetPhysicsRadius(0)

        local extra_arrive_dist = (bufferedaction ~= nil and bufferedaction.action ~= nil and bufferedaction.action.extra_arrive_dist) or nil
        if extra_arrive_dist ~= nil then
            arrive_dist = arrive_dist + extra_arrive_dist(self.inst, self.dest)
        end

        if bufferedaction ~= nil and bufferedaction.action.mindistance ~= nil and bufferedaction.action.mindistance > arrive_dist then
            arrive_dist = bufferedaction.action.mindistance
        end
    end

    self.arrive_dist = arrive_dist
...
...
lots more code in locomotor.lua

 

Edited by Ultroman

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...