Jump to content
  • 0

craftorders.lua - removeSpecialOrders() improvement


Hammelpilaw

Suggestion

While modding the craftorders.lua I got two problems with the function removeSpecialOrders().

 

local function removeSpecialOrders()
    local entity = Entity()

    for index, name in pairs(entity:getScripts()) do
        if string.match(name, "data/scripts/entity/ai/") then
            entity:removeScript(index)
        end
    end
end

 

1.

The function is local, it should be in the namespace instead to overwrite it in other files that extend craftorders.lua.

 

2.

if string.match(name, "data/scripts/entity/ai/") then

should be replaced by

if string.match(name, "/scripts/entity/ai/") then

to remove order scripts in "mods/mymod/scripts/entity/ai/" too.

 

Link to comment
Share on other sites

0 answers to this suggestion

Recommended Posts

There have been no answers to this suggestion yet

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