Permalink
Browse files

fixed players kills and respown

  • Loading branch information...
1 parent 0169c02 commit 69667af6ac5da6f5b7edfc7055350978c5e10a22 @Alerion committed Jul 10, 2011
Showing with 16 additions and 8 deletions.
  1. +8 −3 src/main/forms.py
  2. +3 −3 src/main/models.py
  3. +4 −1 src/templates/main/_panel.html
  4. +1 −1 src/templates/main/add_game.html
View
@@ -1,12 +1,17 @@
+# -*- coding: utf-8 -*-
from django import forms
from models import Game
class GameForm(forms.ModelForm):
- max_players = forms.IntegerField(max_value=8, min_value=1)
- death_limit = forms.IntegerField(max_value=20, min_value=1)
+ max_players = forms.IntegerField(max_value=8, min_value=1, initial=4,
+ help_text=u'1-8 игроков', label=u'Кол. игроков')
+ death_limit = forms.IntegerField(max_value=20, min_value=1, initial=10,
+ help_text=u'1-20', label=u'лимит смертей')
+ unmove_max_time = forms.IntegerField(max_value=30, min_value=5, initial=10,
+ help_text=u'5-30 сек.', label=u'макс. AFK')
class Meta:
- fields = ['name', 'max_players', 'size', 'death_limit']
+ fields = ['name', 'max_players', 'size', 'death_limit', 'unmove_max_time']
model = Game
View
@@ -70,7 +70,7 @@ def respown(self):
self.cell = self.game.get_respown_cell()
self.death_time = 0
self.is_dead = False
- self.last_move_time = 0
+ self.last_move_time = time.time()
self.save()
msg = {
@@ -152,10 +152,10 @@ def record(self):
}
class Game(models.Model):
- name = models.CharField(max_length=140, null=True, blank=True)
+ name = models.CharField(max_length=140, null=True, blank=True, verbose_name=u'название')
status = models.IntegerField(default=0, choices=GAME_STATUS_CHOICES)
max_players = models.PositiveIntegerField(default=4)
- size = models.CharField(default='small', choices=GAME_SIZE_CHOICES, max_length=10)
+ size = models.CharField(default='small', choices=GAME_SIZE_CHOICES, max_length=10, verbose_name=u'Размер')
winner = models.ForeignKey(Player, related_name='winned_games', null=True, blank=True)
created = models.DateTimeField(auto_now_add=True)
started = models.DateTimeField(null=True, blank=True)
@@ -1,4 +1,7 @@
-<b>{{ game }}(лимит смертей - {{ game.death_limit }})</b>
+<b>{{ game }}</b>
+лимит смертей: {{ game.death_limit }}<br/>
+макс. AFK: {{ game.unmove_max_time }}<br/>
+
<table>
<thead>
<td>имя</td>
@@ -10,6 +10,6 @@ <h1>Homber Man</h1>
{{ form }}
</table>
{% csrf_token %}
- <input type='submit' />
+ <input type='submit' value='Создать'/>
</form>
{% endblock %}

0 comments on commit 69667af

Please sign in to comment.