Golf

by Ohead

Adds golf to the game. Craftable clubs, golf balls, and golf holes. Comes with a nine hole golf course scenario (My best score is 52, with the par total being 32). Rebindable walking toggle to line up shots more accurately (LCTRL by default). Does NOT work in multiplayer, it'll crash the game! (I'm working to fix this)

Content
1 year, 3 months ago
1.1
95

b Crash without a character

1 year, 3 months ago
(updated 1 year, 3 months ago)

Sorry, it seems I double-posted and now I can't change the title of this post. Anyway, I've got a second crash:

The mod Golf (0.1.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event golf::on_player_used_capsule (ID 76)
__golf__/control.lua:397: attempt to index global 'ball' (a nil value)
stack traceback:
  __golf__/control.lua:397: in function 'hit_nearest_ball'
  __golf__/control.lua:449: in function <__golf__/control.lua:408>

This is the crashing line:

hit_counts[ball.unit_number] = hit_counts[ball.unit_number] + 1

However, you get the closest ball with

local the_chosen_one, _ = find_closest_ball(player,ball_hit_range)

while ball is never defined in function hit_nearest_ball. It looks like you renamed ball to the_chosen_one at some point, but forgot to change that name in line 397.

New response