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 | |
parent | 56dbbf8c1a61bb5bf729faaab1c1459ac24d40a5 (diff) | |
download | cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.gz cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.bz2 cars-55221272978a4f8bb283747c66cb08743bbbc9a8.tar.xz cars-55221272978a4f8bb283747c66cb08743bbbc9a8.zip |
Simplify behavior
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | init.lua | 23 |
2 files changed, 4 insertions, 25 deletions
@@ -23,13 +23,9 @@ Use: Punch anything with a "Car" to turn into a car. You will only be able to see it from third-person view (press F7). This has the following effects: -* Takes your "Car" -* Gives you an "Un-Car" * Makes you appear to be a car * Makes you faster (if anticheat is off), unable to jump, and heavier Note that it does *not* change your collision box or anything related to that, in an attempt to maintain compatibility with narrow roads. -Once you are a car, you can punch anything with an "Un-Car" to restore everything to normal. - -If you leave and rejoin, you will be a human (or whatever you normally are) again, but still have an "Un-Car". Punch anything with it to turn it back into a "Car". +Once you are a car, you can punch anything with a "car" (again) to restore everything to normal. @@ -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"}, |