Jupiters Posted August 14, 2015 Share Posted August 14, 2015 For example, "berrybush.lua": local function onpickedfn(inst, picker) if inst.components.pickable ~= nil then --V2C: nil cycles_left means unlimited picks, so use max value for math local old_percent = inst.components.pickable.cycles_left ~= nil and (inst.components.pickable.cycles_left + 1) / inst.components.pickable.max_cycles or 1 inst.AnimState:PlayAnimation( (old_percent >= .9 and "berriesmost_picked") or (old_percent >= .33 and "berriesmore_picked") or "berries_picked") inst.AnimState:PushAnimation( inst.components.pickable:IsBarren() and "idle_dead" or "idle") end if not picker:HasTag("berrythief") and math.random() < TUNING.PERD_SPAWNCHANCE then inst:DoTaskInTime(3 + math.random() * 3, spawnperd) endend The code above is in "berrybush.lua". I want to add a line " inst.components.pickable.cycles_left = 5 " right under the first line. That means the code is: local function onpickedfn(inst, picker) inst.components.pickable.cycles_left = 5 if inst.components.pickable ~= nil then --V2C: nil cycles_left means unlimited picks, so use max value for math local old_percent = inst.components.pickable.cycles_left ~= nil and (inst.components.pickable.cycles_left + 1) / inst.components.pickable.max_cycles or 1 inst.AnimState:PlayAnimation( (old_percent >= .9 and "berriesmost_picked") or (old_percent >= .33 and "berriesmore_picked") or "berries_picked") inst.AnimState:PushAnimation( inst.components.pickable:IsBarren() and "idle_dead" or "idle") end if not picker:HasTag("berrythief") and math.random() < TUNING.PERD_SPAWNCHANCE then inst:DoTaskInTime(3 + math.random() * 3, spawnperd) endend How do I do it in modmain.lua to add a line or delete a line? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now