diff options
author | cheapie <no-email-for-you@example.com> | 2016-02-01 16:24:16 -0600 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2016-02-01 16:24:16 -0600 |
commit | 55221272978a4f8bb283747c66cb08743bbbc9a8 (patch) | |
tree | 95e56fb8ac9276a8603c0dd6bfaa7f1ecd63a816 /init.lua | |
parent | 56dbbf8c1a61bb5bf729faaab1c1459ac24d40a5 (diff) | |
download | cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.gz cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.bz2 cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.xz cars-55221272978a4f8bb283747c66cb08743bbbc9a8.zip |
Simplify behavior
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 23 |
1 files changed, 3 insertions, 20 deletions
@@ -1,39 +1,22 @@ -cars = {} -cars.current_cars = {} - +cars = {["current_cars"]={}} minetest.register_craftitem("cars:car",{ description = "Car", inventory_image = "cars_car_inv.png", - stack_max = 1, on_use = function(_,user) local name = user:get_player_name() if cars.current_cars[name] == nil then cars.current_cars[name] = {} cars.current_cars[name].properties = user:get_properties() cars.current_cars[name].physics_override = user:get_physics_override() - user:set_properties({mesh="cars_car.obj",textures={"cars_car.png"}}) + user:set_properties({visual="mesh",visual_size={x=1,y=1},mesh="cars_car.obj",textures={"cars_car.png"}}) user:set_physics_override({speed=(minetest.setting_getbool("disable_anticheat")== true and 1.5 or 1),jump=0,gravity=2}) - end - return ItemStack("cars:uncar 1") - end} -) - -minetest.register_craftitem("cars:uncar",{ - description = "Un-Car", - inventory_image = "cars_uncar_inv.png", - stack_max = 1, - groups = {not_in_creative_inventory=1}, - on_use = function(_,user) - local name = user:get_player_name() - if cars.current_cars[name] ~= nil then + else user:set_properties(cars.current_cars[name].properties) user:set_physics_override(cars.current_cars[name].physics_override) cars.current_cars[name] = nil end - return ItemStack("cars:car 1") end} ) - minetest.register_craft({output="cars:car 1",recipe={ {"default:glass","default:steel_ingot",""}, {"homedecor:motor","default:steel_ingot","default:steel_ingot"}, |