21 lines
833 B
Python
21 lines
833 B
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields
|
|
from .constants import RESOURCE_TYPE_SELECTION
|
|
|
|
|
|
class YtResource(models.Model):
|
|
"""资源(框架模型)。本期仅结构,不接入玩法产出/消耗。"""
|
|
_name = 'yt.resource'
|
|
_description = '资源(框架)'
|
|
|
|
tile_id = fields.Many2one('yt.world.tile', string='所属地块', ondelete='cascade')
|
|
micro_id = fields.Many2one('yt.world.tile.micro', string='所属微观世界', ondelete='cascade')
|
|
type = fields.Selection(RESOURCE_TYPE_SELECTION, string='资源类型')
|
|
amount = fields.Float(string='数量', default=0.0)
|
|
capacity = fields.Float(string='容量上限', default=100.0) # [PLACEHOLDER] 调参
|
|
|
|
_sql_constraints = [
|
|
('uniq_res_tile', 'unique(tile_id, type)',
|
|
'同地块同类型资源唯一'),
|
|
]
|