- 好友
- 19
- 在线时间
- 1653 小时
- 最后登录
- 2024-11-14
骑士
民间工匠
- UID
- 1115705
- 第纳尔
- 4062
- 精华
- 0
- 互助
- 26
- 荣誉
- 2
- 贡献
- 0
- 魅力
- 30
- 注册时间
- 2012-12-13
鲜花( 235) 鸡蛋( 10)
|
本帖最后由 a1550887802 于 2024-8-1 23:31 编辑
视频链接
在某个群里,有些汽油非要我把一些陈年代码分享出来
这个就是其中之一,简易轨道车,非常不完善,希望感兴趣的朋友可以看看
全部都是module_scene_props.py的代码,不涉及其他复杂内容
- ##################################################
- ("zz_zz_z_simple_vehicle_b",sokf_moveable|sokf_type_ladder|spr_use_time(3),"simple_vehicle_b","bo_simple_vehicle_b",
- [
- (ti_on_scene_prop_init,
- [
- (store_trigger_param_1, ":sprop_instance"),
- (scene_prop_set_cur_hit_points, ":sprop_instance", 10000000),
- (init_position,pos50),
- (position_move_z, pos50, -50000),
- (set_spawn_position, pos50),
- #(spawn_scene_prop,"spr_zz_zz_z_simple_ship_add"),
- #(assign,":scene_prop_c",reg0),
- #(scene_prop_set_slot,":scene_prop_c",scene_prop_slots_end,":sprop_instance"),
-
- ]),
- (ti_on_scene_prop_use,
- [
- #(store_trigger_param_1, ":agent_id"),
- (store_trigger_param_2, ":instance_id"),
- (prop_instance_get_starting_position, pos45, ":instance_id"),
- (scene_prop_set_slot,":instance_id",scene_prop_belfry_platform_moved,20),
- #(position_move_y, pos45,40),
- (prop_instance_animate_to_position,":instance_id",pos45,500),
- ]),
-
- (ti_on_scene_prop_animation_finished,
- [
-
- (store_trigger_param_1, ":sprop_instance"),
-
-
- (scene_prop_get_slot, ":speed", ":sprop_instance", scene_prop_belfry_platform_moved),
-
-
-
- (try_begin),
-
- (gt,":speed", 0),
- (assign, ":close", 0),#(assign, ":speed", 200),
-
- (prop_instance_get_position,pos45,":sprop_instance"),
- #(position_set_z_to_ground_level, pos45),
-
- (try_for_prop_instances, ":origin_no","spr_zz_z_simple_vehicle_track"),
- (neq, ":close", 1),
- (prop_instance_get_position,pos30,":origin_no"),
- (get_distance_between_positions,":distance_between",pos45,pos30),
- (lt, ":distance_between", 100),
- (position_copy_rotation,pos45,pos30),
- (set_fixed_point_multiplier, 100), #to match cm returned by get_distance_between_positions
- (position_get_z,":get_z",pos30),
- (position_set_z,pos45,":get_z"),
- (set_fixed_point_multiplier, 1),
- (position_move_y, pos30,1000),
-
- #(assign, ":save_fpm", 1),
- #(convert_to_fixed_point, ":save_fpm"), #set fixed point
- (set_fixed_point_multiplier, 100), #to match cm returned by get_distance_between_positions
- (init_position, pos62),
- (position_transform_position_to_local, pos62, pos45, pos30), #60 = attacker, 61 = target
- (position_get_x, ":x_distance", pos62),
- (position_get_y, ":y_distance", pos62),
- (position_get_z, ":z_distance", pos62), #now there are relative length
-
- (store_atan2, ":theta", ":z_distance", ":x_distance"),
- #(try_begin),
- # (position_is_behind_position, pos60, pos61),
- # (val_mul, ":theta", -1), #when behind, turn to the opposite
- #(try_end),
- #(position_rotate_y_floating, pos45, ":theta"), #twist to giving plain
- # (prop_instance_set_position, ":tracking_tissue", pos60),
- (position_transform_position_to_local, pos62, pos45, pos30),#for z rotation
- (position_get_x, ":x_distance", pos62),
- (position_get_y, ":y_distance", pos62), #below zero if target is behind
- (position_get_z, ":z_distance", pos62), #now there are relative length
- (store_atan2, ":theta", ":y_distance", ":x_distance"),
- (val_sub, ":theta", 9000), #minus 90 degree
-
- (position_rotate_z_floating, pos45, ":theta"), #twist to giving plain
- (try_end),
-
-
- (set_fixed_point_multiplier, 1),
- (assign, ":var_animate", 10),
- (position_move_y, pos45,":speed"),
- (prop_instance_animate_to_position,":sprop_instance",pos45,":var_animate"),
-
- (try_end),
-
-
- ]),
-
- (ti_on_scene_prop_hit,
- [
- #(store_trigger_param_1, ":instance_no"),
- #(store_trigger_param_2, ":damage"),
-
- (try_begin),
- #(scene_prop_get_hit_points, ":hit_points", ":instance_no"),
- (particle_system_burst, "psys_dummy_smoke", pos1, 3),
- (particle_system_burst, "psys_dummy_straw", pos1, 10),
- (play_sound_at_position, "snd_shield_hit_wood_metal", pos1, 0),
- (try_end),
-
- ]),
- ]),
- ###############################################
- ##################################################
- ("zz_z_simple_vehicle_track",sokf_moveable|sokf_type_ladder,"zz_z_simple_vehicle_track","bo_zz_z_simple_vehicle_track",
- []),
复制代码
|
|