Comments (6)
With the latest update it's now completely broken. I'm getting false positives. Variables that are supposedly not used are actually used.
from godot-vscode-plugin.
Could you please give me an example to reproduct that?
from godot-vscode-plugin.
Here is how below file looks on my screen
extends Node
# Vars
var select_player_index = -1
var mouse_pressed = false
var mouse_pos = Vector2(0, 0)
var damage = {}
# Nodes
onready var player = get_node("/root/Main/Map/Viewport/Player")
onready var ui_animation = get_node("/root/Main/AnimationPlayer")
onready var combat_extras = get_node("/root/Main/CombatExtras")
onready var combat_anim = get_node("/root/Main/CombatExtras/Background")
onready var combat_buttons = get_node("/root/Main/BottomUI/CombatButtons")
onready var combat_team = get_node("/root/Main/TopUI/CombatTeam")
onready var player_team = get_node("/root/Main/BottomUI/PlayerTeam")
func start():
g.ticker_slide_in("COMBAT!!")
ui_animation.play("TopUI_Up")
combat_anim.play("appear")
combat_extras.show()
combat_buttons.show()
# Randomize enemy team and reset enemy bar
g.random_enemy_team()
combat_team.reset_enemy_bar()
func update(delta):
# While dragging the attack line
if g.attacking:
combat_extras.drag_arrow(mouse_pos)
# Only run once after the enemy selection is done
if g.enemy_selection != -1 && !g.attacking:
#var select_enemy = combat_team.get_child(g.enemy_selection)
var sp = g.player_team[select_player_index]
var se = g.enemy_team[g.enemy_selection]
damage = _hit(sp, se)
#print(g.player_team)
print(damage)
#select_enemy.start_shooting(damage.hits, 5) #TODO: Weapon specific speeds
g.enemy_selection = -1
func input(event):
if event.type == InputEvent.MOUSE_BUTTON:
mouse_pressed = event.pressed
if !mouse_pressed:
combat_extras.hide_arrow()
g.attacking = false
if event.type == InputEvent.MOUSE_MOTION && mouse_pressed:
mouse_pos = event.pos
if !g.attacking && g.player_selection != -1:
var select_player = player_team.get_child(g.player_selection)
if select_player.mouse_on:
combat_extras.reset_arrow(select_player.get_pos()+Vector2(12, 247))
select_player_index = g.player_selection
g.attacking = true
func end():
combat_anim.play("disappear")
ui_animation.play("TopUI_Down")
combat_buttons.hide()
func _hit(from, to):
var total_damage = 0
var total_crit = 0
var bullet_hits = []
var jam_round = -1
var double_damage = false
# Damage per bullet
var from_attack = from.attack + from.weapon.attack_bonus
var damage_per_bullet = from.weapon.damage * from_attack * 0.1
var skill_diff = from_attack - to.defense
var critical_cutoff = to.defense * 3 - 2
var total_damage_multiplier = from.weapon.coeff * from.coeff
# Calc total damage coeff
var attack_roll = randi() % 21
if attack_roll <= 2:
return {
"total_crit": 0,
"total_damage": 0,
"double_damage": double_damage,
"hits": bullet_hits
}
elif attack_roll > 2 && attack_roll <= 8:
total_damage_multiplier *= 0.5
elif attack_roll > 8 && attack_roll <= 18:
total_damage_multiplier *= 1
else:
total_damage_multiplier *= 2
double_damage = true
# Call skill total domage coefs
total_damage_multiplier *= c.SKILL_LEVELS[from.skills[from.weapon.type]]
# Check for jam
if randi() % 101 <= from.weapon.jam_rate:
jam_round = randi() % from.weapon.bullets_left
# Per bullet calculation
for i in range(from.weapon.bullets_left):
# If jammed
if i == jam_round:
bullet_hits.append({"is_jammed": true, "damage": 0})
break
var result
var basic_roll = round(randf() * to.defense * 3)
if skill_diff < 0:
if basic_roll == to.defense * 3:
result = to.defense * 3
else:
result = basic_roll + skill_diff
else:
result = basic_roll + abs(skill_diff)
# Check for hit/miss/critical
if result >= skill_diff + to.defense:
# Check for critical
if result > critical_cutoff:
bullet_hits.append({"is_jammed": false , "damage": damage_per_bullet*total_damage_multiplier*-2})
else:
bullet_hits.append({"is_jammed": false , "damage": damage_per_bullet*total_damage_multiplier})
else:
bullet_hits.append({"is_jammed": false, "damage": 0})
# Calc total damage
for bullet in bullet_hits:
if bullet.damage < 0:
total_crit += bullet.damage
else:
total_damage += bullet.damage
return {"total_crit": total_crit, "total_damage": total_damage, "double_damage": double_damage, "hits": bullet_hits}
from godot-vscode-plugin.
This bug should be fixed in next release.
from godot-vscode-plugin.
Thanks
from godot-vscode-plugin.
Is there a chance that we get a new release? this bug is kind of annoying
from godot-vscode-plugin.
Related Issues (20)
- Changing any static functions/variables requires a full restart of Godot HOT 3
- Conditional breakpoints are considered "not supported by this debugger" HOT 1
- Preload file does not exist HOT 1
- Reset connection attempts on successfull connect to a GDScript language server. HOT 2
- Generate wrong node path when dragging node from scene preview tree into gds file
- For me 2.0.0 is broken HOT 3
- Display color picker when editing colors HOT 3
- Dollar-sign shorthand for get_node() inserts extra set of quote marks HOT 7
- v2.0.0 maxes out my CPU HOT 1
- Scene Preview is broken HOT 1
- Breakpoints inside threads are not triggered properly
- Relative preload syntax is not supported HOT 10
- `class_name` claims custom class hides global script class HOT 2
- Need a config setting to explicitly specify project file/dir
- Formatter will break code with << and scientific notiation HOT 1
- Headless LSP can't use relative path HOT 5
- Formatter breaks up xor assignment operator
- Add Lines Before "extends Node" Result in Outline Not Working
- Support for '##' comments grammar scope (for themes)
- Cannot view properties of an object extending Resource type during debugging.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot-vscode-plugin.