Skip to content

Commit 0783053

Browse files
committed
Replaced db.actor:id() with 0 as hard-coded in engine
1 parent 8cd70e7 commit 0783053

File tree

20 files changed

+45
-54
lines changed

20 files changed

+45
-54
lines changed

Optional Features/#1. (Choose From This Folder First)/Less Frequent Emissions/gamedata/scripts/xr_surge_hide.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ function activate_surge(time)
387387
phase = 1
388388
elseif phase == 1 then
389389
weather_surge = false
390-
xr_sound.set_sound_play(db.actor:id(), "blowout_begin")
390+
xr_sound.set_sound_play(0, "blowout_begin") -- 0 = actor ID
391391
level.add_cam_effector("camera_effects\\shell_shock.anm", 20080501, false, "")
392392
level.add_pp_effector("snd_shock.ppe", 20080401, false)
393393
level.set_pp_effector_factor(20080401, 0, 1)

Optional Features/#1. (Choose From This Folder First)/No Emissions/gamedata/scripts/xr_surge_hide.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function activate_surge(time)
377377
phase = 1
378378
elseif phase == 1 then
379379
weather_surge = false
380-
xr_sound.set_sound_play(db.actor:id(), "blowout_begin")
380+
xr_sound.set_sound_play(0, "blowout_begin") -- 0 = actor ID
381381
level.add_cam_effector("camera_effects\\shell_shock.anm", 20080501, false, "")
382382
level.add_pp_effector("snd_shock.ppe", 20080401, false)
383383
level.set_pp_effector_factor(20080401, 0, 1)

Optional Features/#1. (Choose From This Folder First)/No Enemy Map Spots/gamedata/scripts/sim_squad_generic.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function sim_squad_generic:on_npc_death(npc, killer_id)
359359

360360
local st_npc = db.storage[npc_id]
361361
if st_npc ~= nil then
362-
if killer_id == db.actor:id() then
362+
if killer_id == 0 then -- 0 = actor ID
363363
local victim_squad = st_npc.squad_obj
364364
local combat_smart_id = nil
365365
if victim_squad ~= nil then

Optional Features/#2. (Choose From This Folder Last)/Show Only Ally Map Spots/gamedata/scripts/sim_squad_generic.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ function sim_squad_generic:on_npc_death(npc, killer_id)
361361

362362
local st_npc = db.storage[npc_id]
363363
if st_npc ~= nil then
364-
if killer_id == db.actor:id() then
364+
if killer_id == 0 then -- 0 = actor ID
365365
local victim_squad = st_npc.squad_obj
366366
local combat_smart_id = nil
367367
if victim_squad ~= nil then

gamedata/scripts/_g.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ function remove_postprocess()
863863
end
864864
]]
865865
function set_inactivate_input_time(delta)
866-
local actor_storage = db.storage[db.actor:id()]
866+
local actor_storage = db.storage[0] -- 0 = actor ID
867867
actor_storage.disable_input_time = game.get_game_time()
868868
actor_storage.disable_input_idle = delta
869869
level.disable_input()

gamedata/scripts/bind_monster.script

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ end
138138

139139
function generic_object_binder:death_callback(victim, culprit)
140140

141-
if culprit:id() == db.actor:id() then
141+
if culprit:id() == 0 then -- 0 = actor ID
142142
xr_statistic.addKillCount(victim)
143143
xr_statistic.inc_killed_monsters_counter()
144144
end
@@ -199,7 +199,7 @@ function generic_object_binder:hit_callback(victim, amount, local_direction, hit
199199
end
200200

201201
if amount > 0 then
202-
if hitter:id() == db.actor:id() then
202+
if hitter:id() == 0 then -- 0 = actor ID
203203
sim_combat.hit_callback(victim:id())
204204
end
205205
end

gamedata/scripts/dialogs.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ function who_is_npc(first_speaker, second_speaker)
434434
end
435435
return npc
436436
]]
437-
return db.actor:id() == second_speaker:id() and first_speaker or second_speaker
437+
return 0 == second_speaker:id() and first_speaker or second_speaker -- 0 = actor ID
438438
end
439439

440440
--------------------------------------------------------------------------------

gamedata/scripts/game_relations.script

+1-2
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,12 @@ function set_level_faction_community(obj) -- sets personal_goodwill and communit
177177

178178
local obj_com = obj:character_community()
179179
local obj_id = obj:id()
180-
local act_id = act:id()
181180

182181
for k, v in pairs (temp_goodwill_table.communities) do
183182
if obj_com == k then
184183
for kk, vv in pairs (v) do
185184
if kk == obj_id then
186-
relation_registry.set_community_goodwill(k, act_id, vv)
185+
relation_registry.set_community_goodwill(k, 0, vv) -- 0 = actor ID
187186
obj:set_goodwill(vv, act)
188187
v[kk] = nil
189188
end

gamedata/scripts/news_manager.script

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function send_tip(actor, news_id, timeout, sender, showtime, sender_id)
9595
if timeout == nil then timeout = 0 end
9696
if showtime == nil then showtime = 5000 end
9797

98-
xr_sound.set_sound_play(actor:id(), "pda_tips")
98+
xr_sound.set_sound_play(0, "pda_tips") -- 0 = actor ID
9999

100100
local texture = "ui_iconsTotal_grouping"
101101

@@ -187,7 +187,7 @@ local action_descr_by_type =
187187

188188
function send_task(actor, type, _task)
189189
if actor == nil then return false end
190-
xr_sound.set_sound_play(actor:id(), "pda_task")
190+
xr_sound.set_sound_play(0, "pda_task") -- 0 = actor ID
191191
local news_caption = trans(action_descr_by_type[type])
192192
local news_text = trans(_task:get_title())
193193
local task_type = task_manager.get_task_manager():get_task_by_entity_id(tonumber(_task:get_id())).type

gamedata/scripts/ogsm_freeplay.script

+3-5
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ function armagezdec()
3333
del_so("stc_cut_scene_final")
3434
del_so("stc_quest_controller")
3535
-- local obj_by_id = level.object_by_id
36-
local actor_id = db.actor:id()
37-
local npc
3836
-- for id = 1, 65535 do
3937
for id, obj in pairs (db.storage) do
40-
if id ~= actor_id then
41-
npc = obj.object
42-
-- npc = obj_by_id(id)
38+
if id ~= 0 then -- 0 = actor ID
39+
local npc = obj.object
40+
-- local npc = obj_by_id(id)
4341
if npc ~= nil and npc:alive() == true then
4442
npc:kill(npc) -- kill every online NPC at the CNPP
4543
end

gamedata/scripts/pda.script

+1-2
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,10 @@ end
233233
function dialog_wnd_showed()
234234
-- dbglog("[pda.dialog_wnd_showed]: Called!")
235235
dialog_closed = false
236-
local actor_id = db.actor:id()
237236
for id, v in pairs (db.storage) do
238237
local obj = v.object
239238
if obj ~= nil then
240-
if obj:is_talking() and id ~= actor_id then
239+
if obj:is_talking() and id ~= 0 then -- 0 = actor ID
241240
local sound_theme = xr_sound.sound_table[id]
242241
if sound_theme and sound_theme.reset then
243242
sound_theme:reset(id)

gamedata/scripts/post_combat_idle.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function evaluator_combat_enemy:evaluate()
2323
end
2424

2525
if st.timer == nil then
26-
if st.last_best_enemy_id == db.actor:id() then
26+
if st.last_best_enemy_id == 0 then -- 0 = actor ID
2727
st.timer = time_global()
2828
return false
2929
else

gamedata/scripts/sim_squad_generic.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function sim_squad_generic:on_npc_death(npc, killer_id)
359359

360360
local st_npc = db.storage[npc_id]
361361
if st_npc ~= nil then
362-
if killer_id == db.actor:id() then
362+
if killer_id == 0 then -- 0 = actor ID
363363
local victim_squad = st_npc.squad_obj
364364
local combat_smart_id = nil
365365
if victim_squad ~= nil then

gamedata/scripts/sr_bloodsucker.script

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function bloodsucker_attack:update(delta)
102102

103103
-- If marsh creature targeted NPC, not player, disable squad reaction to it:
104104

105-
if self.target_obj:id() ~= actor:id() then
105+
if self.target_obj:id() ~= 0 then -- 0 = actor ID
106106
-- self:reset_restrictions()
107107
self:disable_reaction_final()
108108
if self.target_obj ~= nil and self.target_obj:alive() then
@@ -149,7 +149,7 @@ function bloodsucker_attack:update(delta)
149149
-- If player is victim, ____________ and continue no further:
150150

151151
if self.target_obj ~= nil then
152-
if self.target_obj:id() == actor:id() then
152+
if self.target_obj:id() == 0 then -- 0 = actor ID
153153
self:actor_update(delta)
154154
return
155155
end
@@ -342,7 +342,7 @@ function bloodsucker_attack:set_positions()
342342

343343
if (self:next_point() == 0) then
344344
if self.bloodsucker == nil and self.played_count >= self.sound_count then
345-
if self.target_obj:id() == db.actor:id() then
345+
if self.target_obj:id() == 0 then -- 0 = actor ID
346346
self.st.monster = "bloodsucker_fast"
347347
else
348348
if self.deadly_bloodsucker == true then
@@ -400,7 +400,7 @@ function death_hit(sucker, npc)
400400
local hitted_obj = npc
401401
local power = 0
402402

403-
if hitted_obj:id() == db.actor:id() then
403+
if hitted_obj:id() == 0 then -- 0 = actor ID
404404
power = 0.1
405405
else
406406
power = 1000

gamedata/scripts/task_objects.script

+9-12
Original file line numberDiff line numberDiff line change
@@ -2646,10 +2646,8 @@ function CHideFromSurgeTask:check_task(tm)
26462646
end
26472647
end
26482648

2649-
local act_id = act:id()
2650-
26512649
function blowout_hit_with_pp_and_cam_effectors(blowout_hit, cam_effector_id, pp_effector_id)
2652-
xr_sound.set_sound_play(act_id, blowout_hit)
2650+
xr_sound.set_sound_play(0, blowout_hit) -- 0 = actor ID
26532651
level.add_cam_effector("camera_effects\\shell_shock.anm", cam_effector_id, false, "")
26542652
level.add_pp_effector("snd_shock.ppe", pp_effector_id, false)
26552653
level.set_pp_effector_factor(pp_effector_id, 0, 1.5)
@@ -2693,7 +2691,7 @@ function CHideFromSurgeTask:check_task(tm)
26932691
self.effector_started_time = global_time
26942692
level.set_pp_effector_factor(200208, 1, 0.0075)
26952693
level.add_cam_effector("camera_effects\\earthquake.anm", 200209, true, "")
2696-
xr_sound.play_sound_looped(act_id, "surge_earthquake_sound")
2694+
xr_sound.play_sound_looped(0, "surge_earthquake_sound") -- 0 = actor ID
26972695
elseif not(self.disable_ui) and (_delta>=15000) then
26982696
level.set_weather("[default]", false)
26992697
xr_surge_hide.weather_surge = true
@@ -2712,7 +2710,7 @@ function CHideFromSurgeTask:check_task(tm)
27122710
if level.name()=="marsh" or level.name()=="marsh_nvidia" then
27132711
level.remove_pp_effector(200208)
27142712
level.remove_cam_effector(200209)
2715-
xr_sound.stop_sound_looped(act_id)
2713+
xr_sound.stop_sound_looped(0) -- 0 = actor ID
27162714
end_surge("reversed")
27172715
else
27182716
xr_effects.kill_actor()
@@ -2722,7 +2720,7 @@ function CHideFromSurgeTask:check_task(tm)
27222720
elseif(_delta>=35000) then
27232721
xr_effects.enable_ui(nil, nil)
27242722
level.remove_pp_effector(200208)
2725-
xr_sound.stop_sound_looped(act_id)
2723+
xr_sound.stop_sound_looped(0) -- 0 = actor ID
27262724
end_surge("complete")
27272725
elseif(_delta>=32500) then
27282726
level.remove_cam_effector(200209)
@@ -2757,7 +2755,7 @@ function CHideFromSurgeTask:check_task(tm)
27572755
end
27582756

27592757
function blowout_hit_with_pp_and_cam_effectors(blowout_hit, cam_effector_id, pp_effector_id)
2760-
xr_sound.set_sound_play(act_id, blowout_hit)
2758+
xr_sound.set_sound_play(0, blowout_hit) -- 0 = actor ID
27612759
level.add_cam_effector("camera_effects\\shell_shock.anm", cam_effector_id, false, "")
27622760
level.add_pp_effector("snd_shock.ppe", pp_effector_id, false)
27632761
level.set_pp_effector_factor(pp_effector_id, 0, 1.5)
@@ -2773,10 +2771,10 @@ function CHideFromSurgeTask:check_task(tm)
27732771

27742772
if (self.blowout_rumble_level < 1) and (xr_surge_hide.phase > 1) and (xr_surge_hide.phase < 4 or xr_surge_hide.phase == 5) then
27752773
self.blowout_rumble_level = self.blowout_rumble_level + 0.015
2776-
xr_sound.set_volume_sound_looped(act_id, "blowout_rumble", self.blowout_rumble_level)
2774+
xr_sound.set_volume_sound_looped(0, "blowout_rumble", self.blowout_rumble_level) -- 0 = actor ID
27772775
elseif self.blowout_rumble_level > 0 and xr_surge_hide.phase == 4 then
27782776
self.blowout_rumble_level = self.blowout_rumble_level - 0.11
2779-
xr_sound.set_volume_sound_looped(act_id, "blowout_rumble", self.blowout_rumble_level)
2777+
xr_sound.set_volume_sound_looped(0, "blowout_rumble", self.blowout_rumble_level) -- 0 = actor ID
27802778
end
27812779

27822780
local stt = db.storage[self.target]
@@ -2792,9 +2790,8 @@ function CHideFromSurgeTask:check_task(tm)
27922790
end
27932791

27942792
function CHideFromSurgeTask:give_task(community)
2795-
local act_id = db.actor:id()
2796-
xr_sound.play_sound_looped(act_id, "blowout_rumble")
2797-
xr_sound.set_volume_sound_looped(act_id, "blowout_rumble", self.blowout_rumble_level)
2793+
xr_sound.play_sound_looped(0, "blowout_rumble") -- 0 = actor ID
2794+
xr_sound.set_volume_sound_looped(0, "blowout_rumble", self.blowout_rumble_level) -- 0 = actor ID
27982795
task_objects.CGeneralTask.give_task(self, community)
27992796
end
28002797

gamedata/scripts/xr_conditions.script

+6-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local sim = _G.sim
55
--'------------------------------------------------------
66

77
function is_enemy_actor(enemy, object)
8-
return enemy:id() == db.actor:id()
8+
return enemy:id() == 0 -- actor ID
99
end
1010

1111
function fighting_dist_ge(enemy, npc, p) -- if p[1] == nil, crashes the game
@@ -655,16 +655,14 @@ end
655655

656656
function is_faction_enemy_to_actor(actor, npc, p) -- if p[1] == nil, now crashes the game instead of returning false
657657
local faction = p[1]
658-
local act = db.actor
659-
-- return faction ~= nil and relation_registry.community_goodwill(faction, act:id()) <= -1000
660-
return (relation_registry.community_goodwill(faction, act:id()) + relation_registry.community_relation(faction, act:character_community())) <= -1000
658+
-- return faction ~= nil and relation_registry.community_goodwill(faction, db.actor:id()) <= -1000
659+
return (relation_registry.community_goodwill(faction, 0) + relation_registry.community_relation(faction, db.actor:character_community())) <= -1000
661660
end
662661

663662
function is_faction_friend_to_actor(actor, npc, p) -- if p[1] == nil, now crashes the game instead of returning false
664663
local faction = p[1]
665-
local act = db.actor
666-
-- return faction ~= nil and relation_registry.community_goodwill(faction, act:id()) >= 1000
667-
return (relation_registry.community_goodwill(faction, act:id()) + relation_registry.community_relation(faction, act:character_community())) >= 1000
664+
-- return faction ~= nil and relation_registry.community_goodwill(faction, db.actor:id()) >= 1000
665+
return (relation_registry.community_goodwill(faction, 0) + relation_registry.community_relation(faction, db.actor:character_community())) >= 1000
668666
end
669667

670668
function is_squad_enemy_to_actor(actor, npc, p) -- if p[1] == nil, now crashes the game instead of returning false
@@ -681,7 +679,7 @@ end
681679

682680
function hit_by_actor(actor, npc)
683681
local t = db.storage[npc:id()].hit
684-
return t ~= nil and t.who == actor:id()
682+
return t ~= nil and t.who == 0 -- actor ID
685683
end
686684

687685
function actor_has_weapon(actor, npc)

gamedata/scripts/xr_danger.script

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ function evaluator_danger:evaluate()
7171
end
7272

7373
local actor = db.actor
74-
local actor_id = actor:id()
74+
-- local actor_id = actor:id()
7575

76-
if best_danger_object:id() == actor_id and (bd_type == danger_object_attack_sound or bd_type == danger_object_bullet_ricochet) then
76+
if best_danger_object:id() == 0 and (bd_type == danger_object_attack_sound or bd_type == danger_object_bullet_ricochet) then -- 0 = actor ID
7777
if sobj:best_enemy() == nil and sobj:relation(actor) ~= game_object_enemy then
7878
return false
7979
end

gamedata/scripts/xr_effects.script

+4-4
Original file line numberDiff line numberDiff line change
@@ -1776,9 +1776,9 @@ end
17761776
function stc_boom(actor, npc, p)
17771777
local p1 = p and p[1]
17781778
if p1 then
1779-
xr_sound.set_sound_play(db.actor:id(), p1)
1779+
xr_sound.set_sound_play(0, p1) -- 0 = actor ID
17801780
else
1781-
xr_sound.set_sound_play(db.actor:id(), "blowout_begin")
1781+
xr_sound.set_sound_play(0, "blowout_begin")
17821782
end
17831783
level.add_cam_effector("camera_effects\\shell_shock.anm", 20080501, false, "")
17841784
level.add_cam_effector("camera_effects\\earthquake_00.anm", 203450545, false, "")
@@ -1796,15 +1796,15 @@ end
17961796
function start_surge_on_stancia_2(actor, npc, p)
17971797
local fx = (p and p[1]) or "fx_surge_day_3_stancia"
17981798
level.set_weather_fx(fx)
1799-
xr_sound.set_sound_play(db.actor:id(), "blowout_begin")
1799+
xr_sound.set_sound_play(0, "blowout_begin") -- 0 = actor ID
18001800
level.add_cam_effector("camera_effects\\earthquake.anm", 203450545, false, "")
18011801
level.add_cam_effector("camera_effects\\shell_shock.anm", 20080701, false, "")
18021802
level.add_pp_effector("snd_shock.ppe", 20080702, false)
18031803
level.set_pp_effector_factor(20080702, 0, 1)
18041804
end
18051805

18061806
function continue_surge_on_stancia_2(actor, npc)
1807-
xr_sound.play_sound_looped(db.actor:id(), "blowout_rumble")
1807+
xr_sound.play_sound_looped(0, "blowout_rumble") -- 0 = actor ID
18081808
level.add_pp_effector("blink.ppe", 20080703, false)
18091809
level.add_pp_effector("snd_shock.ppe", 20080704, true)
18101810
level.set_pp_effector_factor(20080704, 0, 10)

gamedata/scripts/xr_motivator.script

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function motivator_binder:hit_callback(victim, amount, local_direction, hitter,
237237
local victim_id = victim:id()
238238
-- sr_territory.issue_event(victim, "hit_callback", victim, amount, local_direction, hitter, bone_index)
239239
xr_wounded.hit_callback(victim_id)
240-
if hitter:id() == db.actor:id() then
240+
if hitter:id() == 0 then -- 0 = actor ID
241241
sim_combat.hit_callback(victim_id)
242242
end
243243
end
@@ -254,7 +254,7 @@ function motivator_binder:death_callback(victim, culprit)
254254

255255
stalker_generic.remove_level_spot(victim, st)
256256

257-
if culprit:id() == db.actor:id() then
257+
if culprit:id() == 0 then -- 0 = actor ID
258258
xr_statistic.addKillCount(victim)
259259
xr_statistic.inc_killed_stalkers_counter()
260260
end

gamedata/scripts/xrs_dyn_music.script

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ end
454454
function play_local_combat(actor, npc_obj, actor_pos, npc_id)
455455
if npc_obj:relation(actor) == game_object.enemy then
456456
local best_enemy = npc_obj:best_enemy()
457-
if best_enemy and best_enemy:id() == actor:id() then
457+
if best_enemy and best_enemy:id() == 0 then -- 0 = actor ID
458458
if npc_obj:see(actor) then
459459
play_consider_silence_zone(actor_pos, npc_id, 1)
460460
return true

0 commit comments

Comments
 (0)