add game&rawdata
This commit is contained in:
parent
0133cd976c
commit
49b34b5546
45731 changed files with 709831 additions and 0 deletions
68
gamedata/scripts/bind_artefact.script
Normal file
68
gamedata/scripts/bind_artefact.script
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
--'******************************************************
|
||||
--'* Áèíäåð îáúåêòà àðòåôàêò .
|
||||
--'******************************************************
|
||||
function printf()
|
||||
end
|
||||
|
||||
function bind(obj)
|
||||
obj:bind_object(artefact_binder(obj))
|
||||
end
|
||||
|
||||
class "artefact_binder" (object_binder)
|
||||
function artefact_binder:__init(obj) super(obj)
|
||||
db.storage[self.object:id()] = { }
|
||||
end
|
||||
function artefact_binder:net_spawn(server_object)
|
||||
if not object_binder.net_spawn(self, server_object) then
|
||||
return false
|
||||
end
|
||||
db.add_obj(self.object)
|
||||
local artefact = self.object:get_artefact()
|
||||
local id = self.object:id()
|
||||
if bind_anomaly_zone.artefact_ways_by_id[id] ~= nil then
|
||||
local anomal_zone = bind_anomaly_zone.parent_zones_by_artefact_id[id]
|
||||
local force_xz = anomal_zone.applying_force_xz
|
||||
local force_y = anomal_zone.applying_force_y
|
||||
artefact:FollowByPath(bind_anomaly_zone.artefact_ways_by_id[id],bind_anomaly_zone.artefact_points_by_id[id],vector():set(force_xz,force_y,force_xz))
|
||||
-- artefact:FollowByPath(bind_anomaly_zone.artefact_ways_by_id[id],0,vector():set(force_xz,force_y,force_xz))
|
||||
end
|
||||
|
||||
self.first_call = true
|
||||
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
function artefact_binder:update(delta)
|
||||
object_binder.update(self, delta)
|
||||
printf("pl:art [%s] pos %s", self.object:name(), vec_to_str(self.object:position()))
|
||||
|
||||
if self.first_call == true then
|
||||
local ini = self.object:spawn_ini()
|
||||
if not (ini and ini:section_exist("fixed_bone")) then
|
||||
return
|
||||
end
|
||||
local bone_name = ini:r_string("fixed_bone", "name")
|
||||
|
||||
local ph_shell = self.object:get_physics_shell()
|
||||
if not ph_shell then
|
||||
--printf("no ph shell")
|
||||
return
|
||||
end
|
||||
|
||||
local ph_element = ph_shell:get_element_by_bone_name(bone_name)
|
||||
|
||||
if ph_element:is_fixed() then
|
||||
--printf("OBJECT FIXED")
|
||||
else
|
||||
--printf("FIXING OBJECT")
|
||||
ph_element:fix()
|
||||
end
|
||||
self.first_call = false
|
||||
end
|
||||
|
||||
end
|
||||
function artefact_binder:net_destroy(server_object)
|
||||
db.del_obj(self.object)
|
||||
object_binder.net_destroy(self)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue