1
+ use hitman_commons:: resourcelib:: { EntityBlueprint , EntityBlueprintLegacy , EntityFactory , EntityFactoryLegacy } ;
2
+ use hitman_commons:: rpkg_tool:: RpkgResourceMeta ;
1
3
use quickentity_rs:: patch_structs:: Patch ;
2
4
use quickentity_rs:: qn_structs:: Entity ;
3
- use quickentity_rs:: rpkg_structs:: ResourceMeta ;
4
- use quickentity_rs:: rt_structs:: { RTBlueprint , RTFactory } ;
5
- use quickentity_rs:: { convert_2016_blueprint_to_modern, convert_2016_factory_to_modern} ;
6
5
7
6
use serde:: Serialize ;
8
7
use serde_json:: ser:: Formatter ;
@@ -22,29 +21,37 @@ pub fn read_as_entity(path: &str) -> Entity {
22
21
. expect ( "Failed to parse file" )
23
22
}
24
23
25
- pub fn read_as_rtfactory ( path : & str ) -> RTFactory {
24
+ pub fn read_as_rtfactory ( path : & str ) -> EntityFactory {
26
25
let x = fs:: read ( path) . expect ( "Failed to read file" ) ;
27
- let val: Value = serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to parse file" ) ;
26
+ let val: Value =
27
+ serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to parse file" ) ;
28
28
29
29
if val. get ( "entityTemplates" ) . is_some ( ) {
30
- convert_2016_factory_to_modern ( & from_value ( val) . expect ( "Failed to read file as RT struct" ) )
30
+ from_value :: < EntityFactoryLegacy > ( val)
31
+ . expect ( "Failed to read file as RT struct" )
32
+ . into_modern ( )
31
33
} else {
32
- serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to read file as RT struct" )
34
+ serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) )
35
+ . expect ( "Failed to read file as RT struct" )
33
36
}
34
37
}
35
38
36
- pub fn read_as_rtblueprint ( path : & str ) -> RTBlueprint {
39
+ pub fn read_as_rtblueprint ( path : & str ) -> EntityBlueprint {
37
40
let x = fs:: read ( path) . expect ( "Failed to read file" ) ;
38
- let val: Value = serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to parse file" ) ;
41
+ let val: Value =
42
+ serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to parse file" ) ;
39
43
40
44
if val. get ( "entityTemplates" ) . is_some ( ) {
41
- convert_2016_blueprint_to_modern ( & from_value ( val) . expect ( "Failed to read file as RT struct" ) )
45
+ from_value :: < EntityBlueprintLegacy > ( val)
46
+ . expect ( "Failed to read file as RT struct" )
47
+ . into_modern ( )
42
48
} else {
43
- serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) ) . expect ( "Failed to read file as RT struct" )
49
+ serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & x) )
50
+ . expect ( "Failed to read file as RT struct" )
44
51
}
45
52
}
46
53
47
- pub fn read_as_meta ( path : & str ) -> ResourceMeta {
54
+ pub fn read_as_meta ( path : & str ) -> RpkgResourceMeta {
48
55
serde_path_to_error:: deserialize ( & mut serde_json:: Deserializer :: from_slice ( & {
49
56
let mut vec = Vec :: new ( ) ;
50
57
fs:: File :: open ( path)
0 commit comments