Add ctype mechanics.

This commit is contained in:
Saveliy Skresanov 2023-10-02 22:41:22 +07:00 committed by Tamás Bálint Misius
parent c4db637887
commit 15a22c6906
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 36 additions and 3 deletions

View File

@ -167,8 +167,25 @@ static int update(UPDATE_FUNC_ARGS)
case PT_RSSS:
if(!rx && !ry)
{
sim->part_change_type(ID(r), x, y, PT_RSST);
int ct_under, tmp_under;
ct_under = parts[ID(r)].ctype;
tmp_under = parts[ID(r)].tmp;
//If there's a correct ctype set, use it
if(ct_under > 0 && ct_under < PT_NUM)
{
sim->create_part(ID(r), x, y, ct_under);
//If there's a correct tmp set, use it for ctype
if(tmp_under > 0 && ct_under < PT_NUM)
parts[ID(r)].ctype = tmp_under;
}
else
sim->part_change_type(ID(r), x, y, PT_RSST);
sim->kill_part(i);
return 1;
}
break;

View File

@ -107,9 +107,25 @@ static int update(UPDATE_FUNC_ARGS)
parts[i].vx = vx;
parts[i].vy = vy;
}
else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST
else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST, make it solid
{
sim->part_change_type(ID(r),x,y,PT_RSSS);
int ct_under, tmp_under;
ct_under = parts[ID(r)].ctype;
tmp_under = parts[ID(r)].tmp;
//If there's a correct ctype set, use it
if(ct_under > 0 && ct_under < PT_NUM)
{
sim->create_part(ID(r), x, y, ct_under);
//If there's a correct tmp set, use it for ctype
if(tmp_under > 0 && ct_under < PT_NUM)
parts[ID(r)].ctype = tmp_under;
}
else
sim->part_change_type(ID(r), x, y, PT_RSSS);
sim->kill_part(i);
return 1;