-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpatch_visit.py
More file actions
65 lines (62 loc) · 2.59 KB
/
Copy pathpatch_visit.py
File metadata and controls
65 lines (62 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import re
path = r'c:\Users\tison\Desktop\FS25 MODS\FS25_NPCFavor\src\scripts\NPCEntity.lua'
with open(path, 'r', encoding='utf-8') as f:
content = f.read()
old = (
"function NPCEntity:buildHotspotPlaceableProxy(npc)\n"
" local name = (npc and npc.name) or \"NPC\"\n"
" local farmId = (g_localPlayer and g_localPlayer.farmId) or 1\n"
" local entityManager = self\n"
" return setmetatable({\n"
" canBeSold = function() return false end,\n"
" getName = function() return tostring(name) end,\n"
" getImageFilename = function() return entityManager:getPortraitImagePath(npc) end,\n"
" getDailyUpkeep = function() return 0 end,\n"
" getAge = function() return 0 end,\n"
" ownerFarmId = farmId,\n"
" storeItem = nil,\n"
" specializations = {},\n"
" }, {\n"
" __index = function(_, k)\n"
" if type(k) == \"string\" and k:sub(1, 5) == \"spec_\" then\n"
" return nil\n"
" end\n"
" return function() return nil end\n"
" end,\n"
" })\n"
"end"
)
new = (
"function NPCEntity:buildHotspotPlaceableProxy(npc)\n"
" local name = (npc and npc.name) or \"NPC\"\n"
" local farmId = (g_localPlayer and g_localPlayer.farmId) or 1\n"
" local entityManager = self\n"
" return setmetatable({\n"
" canBeSold = function() return false end,\n"
" getName = function() return tostring(name) end,\n"
" getImageFilename = function() return entityManager:getPortraitImagePath(npc) end,\n"
" getDailyUpkeep = function() return 0 end,\n"
" getAge = function() return 0 end,\n"
" ownerFarmId = farmId,\n"
" storeItem = nil,\n"
" specializations = {},\n"
" getClass = function() return \"HumanCharacter\" end,\n"
" getFirstName = function() return tostring(name) end,\n"
" getFullName = function() return tostring(name) end,\n"
" }, {\n"
" __index = function(_, k)\n"
" if type(k) == \"string\" and k:sub(1, 5) == \"spec_\" then\n"
" return nil\n"
" end\n"
" return function() return nil end\n"
" end,\n"
" })\n"
"end"
)
if old in content:
content = content.replace(old, new, 1)
with open(path, 'w', encoding='utf-8') as f:
f.write(content)
print('SUCCESS')
else:
print('FAIL')