Bow mechanics added, documentation updated.
This commit is contained in:
+29
-13
@@ -407,9 +407,33 @@ void main()
|
||||
}
|
||||
|
||||
update_fishing();
|
||||
update_bow_shot();
|
||||
|
||||
bool ctrl_down = (key_down(KEY_LCTRL) || key_down(KEY_RCTRL));
|
||||
|
||||
// Bow draw detection
|
||||
if (bow_equipped) {
|
||||
if (ctrl_down && !bow_drawing) {
|
||||
if (get_personal_count(ITEM_ARROWS) > 0) {
|
||||
bow_drawing = true;
|
||||
bow_draw_timer.restart();
|
||||
p.play_stationary("sounds/weapons/bow_draw.ogg", false);
|
||||
} else {
|
||||
speak_ammo_blocked("No arrows.");
|
||||
}
|
||||
}
|
||||
|
||||
if (bow_drawing && !ctrl_down) {
|
||||
release_bow_attack(x);
|
||||
bow_drawing = false;
|
||||
}
|
||||
}
|
||||
if (!bow_equipped && bow_drawing) {
|
||||
bow_drawing = false;
|
||||
}
|
||||
|
||||
// Sling charge detection
|
||||
if (sling_equipped && (key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && !sling_charging) {
|
||||
if (!bow_equipped && sling_equipped && ctrl_down && !sling_charging) {
|
||||
if (get_personal_count(ITEM_STONES) > 0) {
|
||||
sling_charging = true;
|
||||
sling_charge_timer.restart();
|
||||
@@ -421,12 +445,12 @@ void main()
|
||||
}
|
||||
|
||||
// Update sling charge state while holding
|
||||
if (sling_charging && (key_down(KEY_LCTRL) || key_down(KEY_RCTRL))) {
|
||||
if (sling_charging && ctrl_down) {
|
||||
update_sling_charge();
|
||||
}
|
||||
|
||||
// Sling release detection
|
||||
if (sling_charging && (!key_down(KEY_LCTRL) && !key_down(KEY_RCTRL))) {
|
||||
if (sling_charging && !ctrl_down) {
|
||||
release_sling_attack(x);
|
||||
sling_charging = false;
|
||||
if (sling_sound_handle != -1) {
|
||||
@@ -436,20 +460,12 @@ void main()
|
||||
}
|
||||
|
||||
// Non-sling weapon attacks (existing pattern)
|
||||
if (!sling_equipped && !sling_charging) {
|
||||
if (!bow_equipped && !bow_drawing && !sling_equipped && !sling_charging) {
|
||||
int attack_cooldown = 1000;
|
||||
if (spear_equipped) attack_cooldown = 800;
|
||||
if (axe_equipped) attack_cooldown = 1600;
|
||||
|
||||
bool ctrl_down = (key_down(KEY_LCTRL) || key_down(KEY_RCTRL));
|
||||
if (bow_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
|
||||
if (get_personal_count(ITEM_ARROWS) <= 0) {
|
||||
speak_ammo_blocked("No arrows.");
|
||||
} else {
|
||||
attack_timer.restart();
|
||||
perform_attack(x);
|
||||
}
|
||||
} else if (!bow_equipped && !fishing_pole_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
|
||||
if (!fishing_pole_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
|
||||
attack_timer.restart();
|
||||
perform_attack(x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user